Coding Standards: Use consistent placement for ::prepare_links() methods.

This moves the `::prepare_links()` methods in REST API classes next to `::prepare_item_for_response()` where they are used, to bring some consistency across the classes and make code navigation easier.

Includes wrapping some long lines for better readability.

Follow-up to [52079], [52051], [52342], [53721], [53722].

See #55647.

git-svn-id: https://develop.svn.wordpress.org/trunk@53724 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-07-19 16:20:54 +00:00
parent 788a070963
commit e49f452f65
7 changed files with 125 additions and 109 deletions

View File

@@ -625,7 +625,14 @@ class WP_REST_Plugins_Controller extends WP_REST_Controller {
protected function prepare_links( $item ) {
return array(
'self' => array(
'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, substr( $item['_file'], 0, - 4 ) ) ),
'href' => rest_url(
sprintf(
'%s/%s/%s',
$this->namespace,
$this->rest_base,
substr( $item['_file'], 0, - 4 )
)
),
),
);
}