[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/customize/ -> class-wp-customize-nav-menu-setting.php (summary)

Customize API: WP_Customize_Nav_Menu_Setting class

File Size: 651 lines (19 kb)
Included or required: 2 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Customize_Nav_Menu_Setting:: (11 methods):
  __construct()
  value()
  preview()
  filter_wp_get_nav_menus()
  _sort_menus_by_orderby()
  filter_wp_get_nav_menu_object()
  filter_nav_menu_options()
  sanitize()
  update()
  filter_nav_menu_options_value()
  amend_customize_save_response()


Class: WP_Customize_Nav_Menu_Setting  - X-Ref

Customize Setting to represent a nav_menu.

Subclass of WP_Customize_Setting to represent a nav_menu taxonomy term, and
the IDs for the nav_menu_items associated with the nav menu.

__construct( WP_Customize_Manager $manager, $id, array $args = array()   X-Ref
Constructor.

Any supplied $args override class property defaults.

param: WP_Customize_Manager $manager Customizer bootstrap instance.
param: string               $id      A specific ID of the setting.
param: array                $args    Optional. Setting arguments.
since: 4.3.0

value()   X-Ref
Get the instance data for a given widget setting.

return: array Instance data.
since: 4.3.0

preview()   X-Ref
Handle previewing the setting.

return: bool False if method short-circuited due to no-op.
since: 4.3.0
since: 4.4.0 Added boolean return value

filter_wp_get_nav_menus( $menus, $args )   X-Ref
Filters the wp_get_nav_menus() result to ensure the inserted menu object is included, and the deleted one is removed.

return: WP_Term[] Array of menu objects.
param: WP_Term[] $menus An array of menu objects.
param: array     $args  An array of arguments used to retrieve menu objects.
since: 4.3.0

_sort_menus_by_orderby( $menu1, $menu2 )   X-Ref
Sort menu objects by the class-supplied orderby property.

This is a workaround for a lack of closures.

return: int
param: object $menu1
param: object $menu2
since: 4.3.0

filter_wp_get_nav_menu_object( $menu_obj, $menu_id )   X-Ref
Filters the wp_get_nav_menu_object() result to supply the previewed menu object.

Requesting a nav_menu object by anything but ID is not supported.

return: object|null
param: object|null $menu_obj Object returned by wp_get_nav_menu_object().
param: string      $menu_id  ID of the nav_menu term. Requests by slug or name will be ignored.
since: 4.3.0

filter_nav_menu_options( $nav_menu_options )   X-Ref
Filters the nav_menu_options option to include this menu's auto_add preference.

return: array (Maybe) modified nav menu options.
param: array $nav_menu_options Nav menu options including auto_add.
since: 4.3.0

sanitize( $value )   X-Ref
Sanitize an input.

Note that parent::sanitize() erroneously does wp_unslash() on $value, but
we remove that in this override.

return: array|false|null Null if an input isn't valid. False if it is marked for deletion.
param: array $value The menu value to sanitize.
since: 4.3.0

update( $value )   X-Ref
Create/update the nav_menu term for this setting.

Any created menus will have their assigned term IDs exported to the client
via the {@see 'customize_save_response'} filter. Likewise, any errors will be exported
to the client via the customize_save_response() filter.

To delete a menu, the client can send false as the value.

return: null|void
param: array|false $value {
since: 4.3.0

filter_nav_menu_options_value( $nav_menu_options, $menu_id, $auto_add )   X-Ref
Updates a nav_menu_options array.

return: array (Maybe) modified nav_menu_options array.
param: array $nav_menu_options Array as returned by get_option( 'nav_menu_options' ).
param: int   $menu_id          The term ID for the given menu.
param: bool  $auto_add         Whether to auto-add or not.
since: 4.3.0

amend_customize_save_response( $data )   X-Ref
Export data for the JS client.

return: array Export data.
param: array $data Additional information passed back to the 'saved' event on `wp.customize`.
since: 4.3.0



Generated: Sat Nov 23 01:00:02 2024 Cross-referenced by PHPXref 0.7.1