[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

Customize API: WP_Customize_Nav_Menu_Item_Setting class

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

Defines 1 class

WP_Customize_Nav_Menu_Item_Setting:: (13 methods):
  __construct()
  flush_cached_value()
  value()
  get_original_title()
  get_type_label()
  populate_value()
  preview()
  filter_wp_get_nav_menu_items()
  sort_wp_get_nav_menu_items()
  value_as_wp_post_nav_menu_item()
  sanitize()
  update()
  amend_customize_save_response()


Class: WP_Customize_Nav_Menu_Item_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.

flush_cached_value( $menu_id, $menu_item_id )   X-Ref
Clear the cached value when this nav menu item is updated.

param: int $menu_id       The term ID for the menu.
param: int $menu_item_id  The post ID for the menu item.

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

return: array|false Instance data array, or false if the item is marked for deletion.

get_original_title( $item )   X-Ref
Get original title.

return: string The original title.
param: object $item Nav menu item.

get_type_label( $item )   X-Ref
Get type label.

return: string The type label.
param: object $item Nav menu item.

populate_value()   X-Ref
Ensure that the value is fully populated with the necessary properties.

Translates some properties added by wp_setup_nav_menu_item() and removes others.


preview()   X-Ref
Handle previewing the setting.

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

filter_wp_get_nav_menu_items( $items, $menu, $args )   X-Ref
Filters the wp_get_nav_menu_items() result to supply the previewed menu items.

return: WP_Post[] Array of menu item objects.
param: WP_Post[] $items An array of menu item post objects.
param: WP_Term   $menu  The menu object.
param: array     $args  An array of arguments used to retrieve menu item objects.

sort_wp_get_nav_menu_items( $items, $menu, $args )   X-Ref
Re-apply the tail logic also applied on $items by wp_get_nav_menu_items().

return: WP_Post[] Array of menu item objects.
param: WP_Post[] $items An array of menu item post objects.
param: WP_Term   $menu  The menu object.
param: array     $args  An array of arguments used to retrieve menu item objects.

value_as_wp_post_nav_menu_item()   X-Ref
Get the value emulated into a WP_Post and set up as a nav_menu_item.

return: WP_Post With wp_setup_nav_menu_item() applied.

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|WP_Error Null or WP_Error if an input isn't valid. False if it is marked for deletion.
param: array $value The menu item value to sanitize.

update( $value )   X-Ref
Creates/updates the nav_menu_item post for this setting.

Any created menu items will have their assigned post 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 The menu item array to update. If false, then the menu item will be deleted

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

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



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref