WC_REST_Setting_Options_V2_Controller::prepare_links() protected WC 3.0.0
Prepare links for the request.
{} It's a method of the class: WC_REST_Setting_Options_V2_Controller{}
No Hooks.
Return
Array. Links for the given setting.
Usage
// protected - for code of main (parent) or child class $result = $this->prepare_links( $setting_id, $group_id );
- $setting_id(string) (required)
- Setting ID.
- $group_id(string) (required)
- Group ID.
Changelog
Since 3.0.0 | Introduced. |
Code of WC_REST_Setting_Options_V2_Controller::prepare_links() WC REST Setting Options V2 Controller::prepare links WC 5.0.0
protected function prepare_links( $setting_id, $group_id ) {
$base = str_replace( '(?P<group_id>[\w-]+)', $group_id, $this->rest_base );
$links = array(
'self' => array(
'href' => rest_url( sprintf( '/%s/%s/%s', $this->namespace, $base, $setting_id ) ),
),
'collection' => array(
'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $base ) ),
),
);
return $links;
}