REST API: Add permalink_structure
to the index endpoint.
This allows Gutenberg to implement permalink editing. Props schlessera. Fixes #42465. git-svn-id: https://develop.svn.wordpress.org/trunk@42142 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d7af48d421
commit
58fad5bf57
@ -1017,15 +1017,16 @@ class WP_REST_Server {
|
|||||||
public function get_index( $request ) {
|
public function get_index( $request ) {
|
||||||
// General site data.
|
// General site data.
|
||||||
$available = array(
|
$available = array(
|
||||||
'name' => get_option( 'blogname' ),
|
'name' => get_option( 'blogname' ),
|
||||||
'description' => get_option( 'blogdescription' ),
|
'description' => get_option( 'blogdescription' ),
|
||||||
'url' => get_option( 'siteurl' ),
|
'url' => get_option( 'siteurl' ),
|
||||||
'home' => home_url(),
|
'home' => home_url(),
|
||||||
'gmt_offset' => get_option( 'gmt_offset' ),
|
'gmt_offset' => get_option( 'gmt_offset' ),
|
||||||
'timezone_string' => get_option( 'timezone_string' ),
|
'timezone_string' => get_option( 'timezone_string' ),
|
||||||
'namespaces' => array_keys( $this->namespaces ),
|
'permalink_structure' => get_option( 'permalink_structure' ),
|
||||||
'authentication' => array(),
|
'namespaces' => array_keys( $this->namespaces ),
|
||||||
'routes' => $this->get_data_for_routes( $this->get_routes(), $request['context'] ),
|
'authentication' => array(),
|
||||||
|
'routes' => $this->get_data_for_routes( $this->get_routes(), $request['context'] ),
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = new WP_REST_Response( $available );
|
$response = new WP_REST_Response( $available );
|
||||||
|
@ -665,6 +665,7 @@ class Tests_REST_Server extends WP_Test_REST_TestCase {
|
|||||||
$this->assertArrayHasKey( 'home', $data );
|
$this->assertArrayHasKey( 'home', $data );
|
||||||
$this->assertArrayHasKey( 'gmt_offset', $data );
|
$this->assertArrayHasKey( 'gmt_offset', $data );
|
||||||
$this->assertArrayHasKey( 'timezone_string', $data );
|
$this->assertArrayHasKey( 'timezone_string', $data );
|
||||||
|
$this->assertArrayHasKey( 'permalink_structure', $data );
|
||||||
$this->assertArrayHasKey( 'namespaces', $data );
|
$this->assertArrayHasKey( 'namespaces', $data );
|
||||||
$this->assertArrayHasKey( 'authentication', $data );
|
$this->assertArrayHasKey( 'authentication', $data );
|
||||||
$this->assertArrayHasKey( 'routes', $data );
|
$this->assertArrayHasKey( 'routes', $data );
|
||||||
|
@ -12,6 +12,7 @@ mockedApiResponse.Schema = {
|
|||||||
"home": "http://example.org",
|
"home": "http://example.org",
|
||||||
"gmt_offset": "0",
|
"gmt_offset": "0",
|
||||||
"timezone_string": "",
|
"timezone_string": "",
|
||||||
|
"permalink_structure": false,
|
||||||
"namespaces": [
|
"namespaces": [
|
||||||
"oembed/1.0",
|
"oembed/1.0",
|
||||||
"wp/v2"
|
"wp/v2"
|
||||||
|
Loading…
Reference in New Issue
Block a user