Commit Graph

140 Commits

Author SHA1 Message Date
Weston Ruter 2214f69e43 Customize: Allow controls to be registered without any associated settings.
* Improves parity between partials and controls. A partial or control can be settingless if instantiated with `settings` param as empty array (otherwise, if null, then the partial/control ID is used). 
* Eliminate need to create dummy settings that serve no purpose except to place a control in the UI.
* Removes dummy settings for `create_new_menu` and `new_menu_name`.
* Introduces `WP_Customize_Control::$capability` and `WP_Customize_Partial::$capability`, and if set checks them in the respective `check_capabilities()` methods.
* Prevents PHP fatal error from happening when non-existing settings are provided to control: "Call to a member function `check_capabilities()` on a non-object".
* Fixes issue where nav menu items and widgets were no longer working with selective refresh because cap check was failing.

See #27355.
Fixes #35926.

Built from https://develop.svn.wordpress.org/trunk@36689


git-svn-id: http://core.svn.wordpress.org/trunk@36656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-24 18:28:28 +00:00
Drew Jaynes 23a6ee1af1 Docs: Hash notate properties and defaults for the benefit of `$args` parameter documentation for `WP_Customize_Control::__construct()`.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@36114


git-svn-id: http://core.svn.wordpress.org/trunk@36079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-28 20:10:35 +00:00
Scott Taylor 68526a8bf1 Customize: move `WP_Customize_Control` subclasses to `wp-includes/customize`, they load in the exact same place.
See #34432.

Built from https://develop.svn.wordpress.org/trunk@35389


git-svn-id: http://core.svn.wordpress.org/trunk@35353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-24 18:57:25 +00:00
Andrea Fercia 1e1e7a9fc9 Customizer: Make the widgets "Reorder" and "Add a Widget" buttons... buttons.
For accessibility, UI controls should preferably be native controls. Adds
ARIA attributes and labels to improve accessibility and pair these buttons
with the ones in the Menu Customizer.

Props obenland, TomHarrigan, sanket.parmar, metodiew, afercia.

Fixes #33327.
Built from https://develop.svn.wordpress.org/trunk@35304


git-svn-id: http://core.svn.wordpress.org/trunk@35270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 20:15:26 +00:00
Scott Taylor 4f16590e8e Customizer: when available, show the `description` when rendering the `dropdown-pages` Control.
Props downstairsdev, MikeHansenMe, _smartik_.
Fixes #31540.

Built from https://develop.svn.wordpress.org/trunk@35275


git-svn-id: http://core.svn.wordpress.org/trunk@35241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 03:48:26 +00:00
Sergey Biryukov 11def634f6 Customizer: `WP_Customize_Cropped_Image_Control` should extend `WP_Customize_Image_Control`, since Site Icon can only an image.
Props paulwilde.
Fixes #34250.
Built from https://develop.svn.wordpress.org/trunk@35018


git-svn-id: http://core.svn.wordpress.org/trunk@34983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-10 23:25:24 +00:00
Scott Taylor addb8fe492 Customizer: make "Current header" clickable in the same way that "Background Image" is - will open the media modal.
Props umesh.nevase.
Fixes #33586.

Built from https://develop.svn.wordpress.org/trunk@34702


git-svn-id: http://core.svn.wordpress.org/trunk@34666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-29 21:40:24 +00:00
Weston Ruter 208330f2dc Customizer: Defer embedding widget controls to improve DOM performance and initial load time.
The Menu Customizer feature includes a performance technique whereby the controls for nav menu items are only embedded into the DOM once the containing menu section is expanded. This commit implements the same DOM deferral for widgets but goes a step further than just embedding the controls once the widget area's Customizer section is expanded: it also defers the embedding of the widget control's form until the widget is expanded, at which point the `widget-added` event also fires to allow any additional widget initialization to be done. The deferred DOM embedding can speed up initial load time by 10x or more. This DOM deferral also yields a reduction in overall memory usage in the browser process.

Includes changes to `wp_widget_control()` to facilitate separating out the widget form from the surrounding accordion container; also includes unit tests for this previously-untested function. Also included are initial QUnit tests (finally) for widgets in the Customizer.

Fixes #33901.

Built from https://develop.svn.wordpress.org/trunk@34563


git-svn-id: http://core.svn.wordpress.org/trunk@34527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 21:02:27 +00:00
Scott Taylor ef87172270 `foreach` is a statement, not a function.
See #33491.

Built from https://develop.svn.wordpress.org/trunk@33734


git-svn-id: http://core.svn.wordpress.org/trunk@33702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 20:28:22 +00:00
Helen Hou-Sandí 7e2cec4edb Customizer: Rename `WP_New_Menu_Customize_Control` to `WP_Customize_New_Menu_Control` for consistency.
props DrewAPicture.
fixes #33324.

Built from https://develop.svn.wordpress.org/trunk@33602


git-svn-id: http://core.svn.wordpress.org/trunk@33569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-10 18:06:25 +00:00
Dominik Schilling a5ed94ab62 Customizer: Add an `aria-expanded` attribute to Edit menu item toggles.
props afercia.
fixes #33129.
Built from https://develop.svn.wordpress.org/trunk@33483


git-svn-id: http://core.svn.wordpress.org/trunk@33450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 09:50:24 +00:00
Dominik Schilling de86d6b18d Customizer: Add missing text or labels to some nav menu UI controls.
props afercia, celloexpressions, westonruter.
fixes #32715.
Built from https://develop.svn.wordpress.org/trunk@33413


git-svn-id: http://core.svn.wordpress.org/trunk@33381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-24 20:28:25 +00:00
Weston Ruter d5ce83c94c Customizer: Introduce `customize_nav_menu_available_item_types` and `customize_nav_menu_available_items` filters.
Allows for new available menu item types/objects to be registered in addition to filtering the available items that are returned for each menu item type/object.

Props valendesigns, imath, westonruter.
See #32832.
Fixes #32708.

Built from https://develop.svn.wordpress.org/trunk@33366


git-svn-id: http://core.svn.wordpress.org/trunk@33338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-22 20:29:25 +00:00
Konstantin Obenland 146befe7bf Customizer: Add label for menu names when editing a menu.
Props celloexpressions.
Fixes #32726.


Built from https://develop.svn.wordpress.org/trunk@33346


git-svn-id: http://core.svn.wordpress.org/trunk@33318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-21 17:02:24 +00:00
Dominik Schilling 4dcfd3ec83 Customizer: Avoid duplicate IDs and remove role presentation from menu items reorder button. Follow-up to [33074].
props afercia.
fixes #32725.
Built from https://develop.svn.wordpress.org/trunk@33339


git-svn-id: http://core.svn.wordpress.org/trunk@33311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-21 11:37:26 +00:00
Dion Hulse 412013a158 Allow HTML/entities in the Active Theme Name in the themes.php & Customizer templates.
Props iCaleb
Fixes #33036

Built from https://develop.svn.wordpress.org/trunk@33327


git-svn-id: http://core.svn.wordpress.org/trunk@33299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-20 01:46:24 +00:00
Weston Ruter 909dde9ce5 Customizer: Move "Menu options" heading outside of a nav menu auto-add control's label.
Standardizes capitalization. Amends [33189].

Props valendesigns.
Fixes #32820.

Built from https://develop.svn.wordpress.org/trunk@33317


git-svn-id: http://core.svn.wordpress.org/trunk@33289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-17 22:42:24 +00:00
Konstantin Obenland 2883bbbb68 Customize: Provide a default way to save cropped images.
Allows plugins and themes to use `WP_Customize_Cropped_Image_Control` without
having to define their own way of saving the cropped image.

Props celloexpressions for initial patch.
Fixes #29211.


Built from https://develop.svn.wordpress.org/trunk@33280


git-svn-id: http://core.svn.wordpress.org/trunk@33252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-15 19:54:25 +00:00
Drew Jaynes eb5b64112b Fix missing or inconsistent parameter descriptions for constructors in `WP_Customize_Control`, `WP_Customize_Color_Control`, `WP_Customize_Media_Control`, `WP_Customize_Image_Control`, `WP_Customize_Background_Image_Control`, `WP_Customize_Site_Icon_Control`, `WP_Customizer_Header_Image_Control`, and `WP_Customize_Nav_Menu_Item_Control`.
See #32891. See #32246.

Built from https://develop.svn.wordpress.org/trunk@33216


git-svn-id: http://core.svn.wordpress.org/trunk@33188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 20:25:24 +00:00
Drew Jaynes 34f0605186 Fix inline documentation syntax, and/or add missing `@access` tags for a variety of Customizer subclasses and methods added in 4.3.
See #32891.

Built from https://develop.svn.wordpress.org/trunk@33215


git-svn-id: http://core.svn.wordpress.org/trunk@33187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 20:17:25 +00:00
Weston Ruter ae50d09585 Customizer: Disambiguate a menu's auto-add pages option from preceding menu location checkboxes.
Creates a separate `nav_menu_auto_add` control type following the pattern of the `nav_menu_name` control type.

Props valendesigns.
Fixes #32820.

Built from https://develop.svn.wordpress.org/trunk@33189


git-svn-id: http://core.svn.wordpress.org/trunk@33161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 08:40:26 +00:00
Dominik Schilling daa51138fc Customizer: Merge two strings.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@33164


git-svn-id: http://core.svn.wordpress.org/trunk@33136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-11 20:05:24 +00:00
Konstantin Obenland 58af8a0784 Better context for autofocused elements for screen readers.
Props joedolson for initial patch.
Fixes #30706.


Built from https://develop.svn.wordpress.org/trunk@33158


git-svn-id: http://core.svn.wordpress.org/trunk@33130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-10 22:23:24 +00:00
Konstantin Obenland f29e5044cd Site Icon: Add Customizer UI.
Second part of the Site Icon feature after [32994] introduced it for Settings.

Props celloexpressions.
See #16434.


Built from https://develop.svn.wordpress.org/trunk@33154


git-svn-id: http://core.svn.wordpress.org/trunk@33126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-10 21:33:24 +00:00
Sergey Biryukov fa1b659d29 Merge two `class` attributes in `WP_Customize_Media_Control::content_template()` and `wp_print_media_templates()`.
props nicholas_io.
fixes #32896.
Built from https://develop.svn.wordpress.org/trunk@33090


git-svn-id: http://core.svn.wordpress.org/trunk@33061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-06 14:19:26 +00:00
Dominik Schilling 200463d781 Customizer: Improve descriptive text and focus for menu items reorder button.
props afercia.
fixes #32725.
Built from https://develop.svn.wordpress.org/trunk@33074


git-svn-id: http://core.svn.wordpress.org/trunk@33045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-03 21:24:25 +00:00
Sergey Biryukov 9e445e3c30 Customizer: Add an `aria-label` attribute to the Add Items button to improve accessibility.
props afercia.
fixes #32713.
Built from https://develop.svn.wordpress.org/trunk@32981


git-svn-id: http://core.svn.wordpress.org/trunk@32952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-28 04:28:24 +00:00
Scott Taylor 8b1286417e `ob_get_contents()` followed by `ob_end_clean()` can be replaced by `ob_get_clean()`.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32965


git-svn-id: http://core.svn.wordpress.org/trunk@32936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:12:24 +00:00
Scott Taylor f61501f57f The `query-attachments` AJAX action immediately errors out if the user doesn't have the `upload_files` cap. As such, the Customizer shouldn't show buttons that launch the media modal when the user doesn't have the proper permissions to query attachments.
See #32654.

Built from https://develop.svn.wordpress.org/trunk@32913


git-svn-id: http://core.svn.wordpress.org/trunk@32884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-23 18:20:27 +00:00
Dominik Schilling 095dfe5386 Customizer: Fix live preview for menu item titles.
Show also a default label for menu items without a label which are assigned to a menu. This is currently only supported in the Customizer, see #24146 for nav menus screen.

see #32576.
Built from https://develop.svn.wordpress.org/trunk@32895


git-svn-id: http://core.svn.wordpress.org/trunk@32866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 22:33:26 +00:00
Dominik Schilling 759bcdbad1 Customizer: Escape original title of menu items.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@32893


git-svn-id: http://core.svn.wordpress.org/trunk@32864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 19:55:25 +00:00
Dominik Schilling 2e8245ba0e Customizer: Use valid markup for menu items.
Replace `<d(l|t)>` with `<div>` for `.menu-item-bar` and `.menu-item-handle`.

see #32724, #32721, #31817.
Built from https://develop.svn.wordpress.org/trunk@32889


git-svn-id: http://core.svn.wordpress.org/trunk@32860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 18:47:27 +00:00
Dominik Schilling 4fdc99d2d1 Customizer: Decode HTML entities in the label property of `WP_Customize_Media_Control`.
fixes #31631.
Built from https://develop.svn.wordpress.org/trunk@32885


git-svn-id: http://core.svn.wordpress.org/trunk@32856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 18:15:26 +00:00
Scott Taylor a75961da89 Add access modifier to `WP_Customize_Nav_Menu_Item_Control::json()`
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32873


git-svn-id: http://core.svn.wordpress.org/trunk@32844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 21:55:24 +00:00
Scott Taylor 24bae70080 Add access modifier to `WP_Customize_Nav_Menu_Control::json()`
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32872


git-svn-id: http://core.svn.wordpress.org/trunk@32843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 21:54:25 +00:00
Konstantin Obenland 50e32a1969 Keep `WP_Customize_Nav_Menus_Panel` with other panels rather than controls.
Accidentally merged into the wrong file in [32806].
H/t celloexpressions for noticing.

See https://wordpress.slack.com/archives/core-customize/p1434696254000258.
See #32576.


Built from https://develop.svn.wordpress.org/trunk@32855


git-svn-id: http://core.svn.wordpress.org/trunk@32826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 08:37:27 +00:00
Dominik Schilling f5fa907f77 Customizer: Improve accessibility of Add Menu Items button and its panel.
props afercia, ocean90.
fixes #32682.
Built from https://develop.svn.wordpress.org/trunk@32848


git-svn-id: http://core.svn.wordpress.org/trunk@32819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-18 20:52:24 +00:00
Dominik Schilling 62e3a0c15c Add menu management to the Customizer.
This brings in the Menu Customizer plugin: https://wordpress.org/plugins/menu-customizer/.

props celloexpressions, westonruter, valendesigns, voldemortensen, ocean90, adamsilverstein, kucrut, jorbin, designsimply, afercia, davidakennedy, obenland.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@32806


git-svn-id: http://core.svn.wordpress.org/trunk@32777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-16 22:08:26 +00:00
Scott Taylor c502a281bb After [32656], add `@access` annotations to methods that have no doc block in `wp-includes/*`.
Makes it easier to search for no doc blocks via `}[\n\t\r ]+(protected|private|public)`.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32657


git-svn-id: http://core.svn.wordpress.org/trunk@32627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 21:37:24 +00:00
Scott Taylor 19a3aacc94 Add `@static*` annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32650


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Scott Taylor bd8fafea54 Use `void` instead of `null` where appropriate when pipe-delimiting `@return` types. If a `@return` only contains `void`, remove it.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32568


git-svn-id: http://core.svn.wordpress.org/trunk@32538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-24 05:40:25 +00:00
Scott Taylor 082bfab426 Clean up `@global` doc blocks/imports for `class-wp-customizer-*.php` and friends.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32542


git-svn-id: http://core.svn.wordpress.org/trunk@32512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 05:06:25 +00:00
Scott Taylor b2bbbf9759 In `class-wp-customize-*`, clarify/add some `@param`/`@return` blocks. Disambiguate some functions that are trying to return the `void` response of another function they call internally.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32535


git-svn-id: http://core.svn.wordpress.org/trunk@32505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-21 22:05:24 +00:00
Sergey Biryukov 708791aa6b Customizer: Use a semantic, accessible element for Remove Header Image button.
Make the button more noticeable on dark, light, and busy images.

props afercia, RDall, melchoyce.
fixes #32227, #31325.
Built from https://develop.svn.wordpress.org/trunk@32382


git-svn-id: http://core.svn.wordpress.org/trunk@32352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-06 10:54:27 +00:00
Dominik Schilling b29c8c503b Theme Switcher: Provide an easier way to reset back to the current active theme.
* Add control for the active theme when doing a theme preview
* Highlight an active theme and move it to the top

props valendesigns, ocean90.
fixes #32002.
Built from https://develop.svn.wordpress.org/trunk@32265


git-svn-id: http://core.svn.wordpress.org/trunk@32236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-22 16:15:27 +00:00
Dominik Schilling 786bce5b9c Customizer: Escape theme preview URLs.
props johnbillion, ocean90.
see #31896.
Built from https://develop.svn.wordpress.org/trunk@32134


git-svn-id: http://core.svn.wordpress.org/trunk@32113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-15 16:33:25 +00:00
Dominik Schilling 755d44736a Customizer Theme Switcher: Lazy load theme screenshots.
props westonruter, ocean90.
fixes #31793.
Built from https://develop.svn.wordpress.org/trunk@32088


git-svn-id: http://core.svn.wordpress.org/trunk@32067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-08 20:52:29 +00:00
Dominik Schilling f7fd1665ae Customizer Theme Switcher: Fix preview URL for subfolder installs.
Use `$_SERVER['HTTP_HOST']` and `$_SERVER['REQUEST_URI']` instead of `site_url()` and `$_SERVER['REQUEST_URI']`.

fixes #31896.
Built from https://develop.svn.wordpress.org/trunk@32086


git-svn-id: http://core.svn.wordpress.org/trunk@32065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-08 18:59:27 +00:00
Drew Jaynes 61d7726737 Add documentation for the `$type` and `$theme` properties in `WP_Customize_Theme_Control`.
Also add some missing `@access` tags to various DocBlocks.

See [31533]. See #31888.

Built from https://develop.svn.wordpress.org/trunk@32028


git-svn-id: http://core.svn.wordpress.org/trunk@32007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 14:53:25 +00:00
Drew Jaynes d63af2b6ee Add documentation for the `$type`, `$mime_type`, and `$button_labels` properties in `WP_Customize_Media_Control`.
See [31698]. See #31888.

Built from https://develop.svn.wordpress.org/trunk@32023


git-svn-id: http://core.svn.wordpress.org/trunk@32002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-04 23:05:26 +00:00