[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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.

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

return: array Instance data.

preview()   X-Ref
Handle previewing the setting.

return: bool False if method short-circuited due to no-op.

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.

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

_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.

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

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.

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.
return: object|null

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

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

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

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

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

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.

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

filter_nav_menu_options_value( $nav_menu_options, $menu_id, $auto_add )   X-Ref
Updates a 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.
return: array (Maybe) modified nav_menu_options array.

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

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



Generated : Thu Mar 28 08:20:01 2024 Cross-referenced by PHPXref