Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: args updated for Settings API endpoints #2483

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion includes/REST/StoreSettingControllerV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_settings_group' ],
'permission_callback' => [ $this, 'get_settings_permission_callback' ],
'args' => [],
'args' => [
'group_id' => [
'description' => __( 'Unique identifier for the settings group.', 'dokan' ),

Check failure on line 55 in includes/REST/StoreSettingControllerV2.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Mismatched text domain. Expected 'dokan-lite' but got 'dokan'.
'type' => 'string',
'required' => true,
],
],
],
[
'methods' => WP_REST_Server::EDITABLE,
Expand All @@ -68,6 +74,18 @@
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_single_settings' ],
'permission_callback' => [ $this, 'get_settings_permission_callback' ],
'args' => [
'group_id' => [
'description' => __( 'Unique identifier for the settings group.', 'dokan' ),

Check failure on line 79 in includes/REST/StoreSettingControllerV2.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Mismatched text domain. Expected 'dokan-lite' but got 'dokan'.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it is not Unique identifier

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bhai, based on this method, I thought it's a unique identifier. Here, the group existence depended on group_id.

    public function get_settings_group( string $group_id ) {
        $group_exist = $this->search_group( $group_id );

        if ( is_wp_error( $group_exist ) ) {
            return $group_exist;
        }

        $settings = apply_filters( 'dokan_vendor_rest_settings_for' . $group_id . '_page', [] );

        return array_map( [ $this, 'populate_settings_elements' ], $settings );
    }

'type' => 'string',
'required' => true,
],
'id' => [
'description' => __( 'Unique identifier for the setting.', 'dokan' ),

Check failure on line 84 in includes/REST/StoreSettingControllerV2.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Mismatched text domain. Expected 'dokan-lite' but got 'dokan'.
'type' => 'string',
'required' => true,
],
],
],
[
'methods' => WP_REST_Server::EDITABLE,
Expand All @@ -85,6 +103,23 @@
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_single_settings_field' ],
'permission_callback' => [ $this, 'get_settings_permission_callback' ],
'args' => [
'group_id' => [
'description' => __( 'Unique identifier for the settings group.', 'dokan' ),

Check failure on line 108 in includes/REST/StoreSettingControllerV2.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Mismatched text domain. Expected 'dokan-lite' but got 'dokan'.
'type' => 'string',
'required' => true,
],
'parent_id' => [
'description' => __( 'Unique identifier for the parent setting.', 'dokan' ),

Check failure on line 113 in includes/REST/StoreSettingControllerV2.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Mismatched text domain. Expected 'dokan-lite' but got 'dokan'.
'type' => 'string',
'required' => true,
],
'id' => [
'description' => __( 'Unique identifier for the setting field.', 'dokan' ),

Check failure on line 118 in includes/REST/StoreSettingControllerV2.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Mismatched text domain. Expected 'dokan-lite' but got 'dokan'.
'type' => 'string',
'required' => true,
],
],
],
[
'methods' => WP_REST_Server::EDITABLE,
Expand Down
Loading