Make WordPress Core

Changes between Initial Version and Version 47 of Ticket #18584


Ignore:
Timestamp:
08/20/2015 06:51:51 PM (9 years ago)
Author:
westonruter
Comment:

I'm re-scoping this in terms of Menu Customizer which was added in 4.3 but also without all of the necessary hooks to be extensible for plugins to easily add new controls. The latest work there was done in #32832 and #32708.

In any case, adding new menu item types and adding fields to existing menu item types should ideally have the same interface whether the extensions are targeting the menus in the customizer or menus on the admin page. Maybe this isn't realistic, but at least there should be parity between the two. I know this also gets into Fields API territory.

On #32832 (comment 16), I put down some thoughts on what needed to be done for menus in the Customizer:

  • Extend WP_Customize_Nav_Menu_Item_Setting::value() to allow plugins to amend the normal value with additional properties, where the filter can draw the properties from postmeta.
  • Allow for custom fields to be inserted into WP_Customize_Nav_Menu_Item_Control::content_template().
  • Allow custom fields to be linked to the new properties in the nav_menu_item setting value, using a similar approach to the link method, although again here we're dealing with sub-properties of a setting, not entire setting value itself.
  • Extend WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item() to amend the returned WP_Post object with the additional properties.
  • Extend WP_Customize_Nav_Menu_Item_Control::sanitize() to allow the amended values to be sanitized.
  • Extend WP_Customize_Nav_Menu_Item_Setting::update() to allow the amended values to be persisted (in postmeta)

I also put forth an assumption that the data source for any menu item custom fields should be sourced from postmeta.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #18584

    • Property Focuses javascript added
    • Property Cc marko@… sirzooro info@… xoodrew@… helgatheviking@… frederic.demarle@… pippin@… justin@… shrkey contact@… added
    • Property Component changed from Menus to Customize
    • Property Priority changed from low to normal
    • Property Milestone changed from Awaiting Review to 4.4
    • Property Severity changed from minor to normal
  • Ticket #18584 – Description

    initial v47  
    44
    55My specific suggestions are before the Remove/Cancel links (i.e. for adding standard stuff), one above the "original" field, and one after those action links (to add more actions).
     6
     7We need to account for both extending the menus admin page and menus in the customizer.