mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-28 10:29:25 +00:00
Copies WP_REST_Block_Navigation_Areas_Controller from the Gutenberg plugin. This provides the /wp/v2/block-navigation-areas endpoint used by the Navigation block. Props antonvlasenko, TimothyBlynJacobs. Fixes #54393. Built from https://develop.svn.wordpress.org/trunk@52133 git-svn-id: http://core.svn.wordpress.org/trunk@51725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
53 lines
1.0 KiB
PHP
53 lines
1.0 KiB
PHP
<?php
|
|
/**
|
|
* Block navigation areas functions.
|
|
*
|
|
* @package WordPress
|
|
*/
|
|
|
|
/**
|
|
* Registers the navigation areas supported by the current theme. The expected
|
|
* shape of the argument is:
|
|
* array(
|
|
* 'primary' => 'Primary',
|
|
* 'secondary' => 'Secondary',
|
|
* 'tertiary' => 'Tertiary',
|
|
* )
|
|
*
|
|
* @since 5.9.0
|
|
*
|
|
* @param array $new_areas Supported navigation areas.
|
|
*/
|
|
function register_navigation_areas( $new_areas ) {
|
|
global $navigation_areas;
|
|
$navigation_areas = $new_areas;
|
|
}
|
|
|
|
/**
|
|
* Register the default navigation areas.
|
|
*
|
|
* @since 5.9.0
|
|
* @access private
|
|
*/
|
|
function _register_default_navigation_areas() {
|
|
register_navigation_areas(
|
|
array(
|
|
'primary' => _x( 'Primary', 'navigation area' ),
|
|
'secondary' => _x( 'Secondary', 'navigation area' ),
|
|
'tertiary' => _x( 'Tertiary', 'navigation area' ),
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Returns the available navigation areas.
|
|
*
|
|
* @since 5.9.0
|
|
*
|
|
* @return array Registered navigation areas.
|
|
*/
|
|
function get_navigation_areas() {
|
|
global $navigation_areas;
|
|
return $navigation_areas;
|
|
}
|