[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

WordPress Customize Nav Menus classes

File Size: 1586 lines (57 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 30 functions

  __construct()
  filter_nonces()
  ajax_load_available_items()
  load_available_items_query()
  ajax_search_available_items()
  search_available_items_query()
  enqueue_scripts()
  filter_dynamic_setting_args()
  filter_dynamic_setting_class()
  customize_register()
  intval_base10()
  available_item_types()
  insert_auto_draft_post()
  ajax_insert_auto_draft_post()
  print_templates()
  available_items_template()
  print_post_type_container()
  print_custom_links_available_menu_item()
  customize_dynamic_partial_args()
  customize_preview_init()
  make_auto_draft_status_previewable()
  sanitize_nav_menus_created_posts()
  save_nav_menus_created_posts()
  filter_wp_nav_menu_args()
  filter_wp_nav_menu()
  hash_nav_menu_args()
  customize_preview_enqueue_deps()
  export_preview_data()
  export_partial_rendered_nav_menu_instances()
  render_nav_menu_partial()

Functions
Functions that are not part of a class:

__construct( $manager )   X-Ref
Constructor.

param: WP_Customize_Manager $manager Customizer bootstrap instance.
since: 4.3.0

filter_nonces( $nonces )   X-Ref
Adds a nonce for customizing menus.

return: string[] Modified array of nonces.
param: string[] $nonces Array of nonces.
since: 4.5.0

ajax_load_available_items()   X-Ref
Ajax handler for loading available menu items.

since: 4.3.0

load_available_items_query( $object_type = 'post_type', $object_name = 'page', $page = 0 )   X-Ref
Performs the post_type and taxonomy queries for loading available menu items.

return: array|WP_Error An array of menu items on success, a WP_Error object on failure.
param: string $object_type Optional. Accepts any custom object type and has built-in support for
param: string $object_name Optional. Accepts any registered taxonomy or post type name. Default is 'page'.
param: int    $page        Optional. The page number used to generate the query offset. Default is '0'.
since: 4.3.0

ajax_search_available_items()   X-Ref
Ajax handler for searching available menu items.

since: 4.3.0

search_available_items_query( $args = array()   X-Ref
Performs post queries for available-item searching.

Based on WP_Editor::wp_link_query().

return: array Menu items.
param: array $args Optional. Accepts 'pagenum' and 's' (search) arguments.
since: 4.3.0

enqueue_scripts()   X-Ref
Enqueues scripts and styles for Customizer pane.

since: 4.3.0

filter_dynamic_setting_args( $setting_args, $setting_id )   X-Ref
Filters a dynamic setting's constructor args.

For a dynamic setting to be registered, this filter must be employed
to override the default false value with an array of args to pass to
the WP_Customize_Setting constructor.

return: array|false
param: false|array $setting_args The arguments to the WP_Customize_Setting constructor.
param: string      $setting_id   ID for dynamic setting, usually coming from `$_POST['customized']`.
since: 4.3.0

filter_dynamic_setting_class( $setting_class, $setting_id, $setting_args )   X-Ref
Allows non-statically created settings to be constructed with custom WP_Customize_Setting subclass.

return: string
param: string $setting_class WP_Customize_Setting or a subclass.
param: string $setting_id    ID for dynamic setting, usually coming from `$_POST['customized']`.
param: array  $setting_args  WP_Customize_Setting or a subclass.
since: 4.3.0

customize_register()   X-Ref
Adds the customizer settings and controls.

since: 4.3.0

intval_base10( $value )   X-Ref
Gets the base10 intval.

This is used as a setting's sanitize_callback; we can't use just plain
intval because the second argument is not what intval() expects.

return: int Integer.
param: mixed $value Number to convert.
since: 4.3.0

available_item_types()   X-Ref
Returns an array of all the available item types.

return: array The available menu item types.
since: 4.3.0
since: 4.7.0  Each array item now includes a `$type_label` in addition to `$title`, `$type`, and `$object`.

insert_auto_draft_post( $postarr )   X-Ref
Adds a new `auto-draft` post.

return: WP_Post|WP_Error Inserted auto-draft post object or error.
param: array $postarr {
since: 4.7.0

ajax_insert_auto_draft_post()   X-Ref
Ajax handler for adding a new auto-draft post.

since: 4.7.0

print_templates()   X-Ref
Prints the JavaScript templates used to render Menu Customizer components.

Templates are imported into the JS use wp.template.

since: 4.3.0

available_items_template()   X-Ref
Prints the HTML template used to render the add-menu-item frame.

since: 4.3.0

print_post_type_container( $available_item_type )   X-Ref
Prints the markup for new menu items.

To be used in the template #available-menu-items.

param: array $available_item_type Menu item data to output, including title, type, and label.
since: 4.7.0

print_custom_links_available_menu_item()   X-Ref
Prints the markup for available menu item custom links.

since: 4.7.0

customize_dynamic_partial_args( $partial_args, $partial_id )   X-Ref
Filters arguments for dynamic nav_menu selective refresh partials.

return: array Partial args.
param: array|false $partial_args Partial args.
param: string      $partial_id   Partial ID.
since: 4.5.0

customize_preview_init()   X-Ref
Adds hooks for the Customizer preview.

since: 4.3.0

make_auto_draft_status_previewable()   X-Ref
Makes the auto-draft status protected so that it can be queried.

since: 4.7.0

sanitize_nav_menus_created_posts( $value )   X-Ref
Sanitizes post IDs for posts created for nav menu items to be published.

return: array Post IDs.
param: array $value Post IDs.
since: 4.7.0

save_nav_menus_created_posts( $setting )   X-Ref
Publishes the auto-draft posts that were created for nav menu items.

The post IDs will have been sanitized by already by
`WP_Customize_Nav_Menu_Items::sanitize_nav_menus_created_posts()` to
remove any post IDs for which the user cannot publish or for which the
post is not an auto-draft.

param: WP_Customize_Setting $setting Customizer setting object.
since: 4.7.0

filter_wp_nav_menu_args( $args )   X-Ref
Keeps track of the arguments that are being passed to wp_nav_menu().

return: array Arguments.
param: array $args An array containing wp_nav_menu() arguments.
since: 4.3.0

filter_wp_nav_menu( $nav_menu_content, $args )   X-Ref
Prepares wp_nav_menu() calls for partial refresh.

Injects attributes into container element.

return: string Nav menu HTML with selective refresh attributes added if partial can be refreshed.
param: string $nav_menu_content The HTML content for the navigation menu.
param: object $args             An object containing wp_nav_menu() arguments.
since: 4.3.0

hash_nav_menu_args( $args )   X-Ref
Hashes (hmac) the nav menu arguments to ensure they are not tampered with when
submitted in the Ajax request.

Note that the array is expected to be pre-sorted.

return: string Hashed nav menu arguments.
param: array $args The arguments to hash.
since: 4.3.0

customize_preview_enqueue_deps()   X-Ref
Enqueues scripts for the Customizer preview.

since: 4.3.0

export_preview_data()   X-Ref
Exports data from PHP to JS.

since: 4.3.0

export_partial_rendered_nav_menu_instances( $response )   X-Ref
Exports any wp_nav_menu() calls during the rendering of any partials.

return: array Response.
param: array $response Response.
since: 4.5.0

render_nav_menu_partial( $partial, $nav_menu_args )   X-Ref
Renders a specific menu via wp_nav_menu() using the supplied arguments.

return: string|false
param: WP_Customize_Partial $partial       Partial.
param: array                $nav_menu_args Nav menu args supplied as container context.
since: 4.3.0



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1