Commit Graph

53 Commits

Author SHA1 Message Date
Weston Ruter
ae2657dd32 Customize: Prevent PHP notice and JS error caused by widgets and nav menus components if user only has customize capability.
Short-circuits components from initializing their hooks needlessly if current user lacks required capability.

Fixes #35895.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-22 05:31:27 +00:00
Weston Ruter
6b775d4afe Customize: Add selective refresh framework with implementation for widgets and re-implementation for nav menus.
See https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/.

Props westonruter, valendesigns, DrewAPicture, ocean90.
Fixes #27355.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-19 18:41:28 +00:00
Dominik Schilling
658d825ea9 Customizer: In nav menus show the location name instead of slug.
Props ryankienstra.
Fixes #34755.
Built from https://develop.svn.wordpress.org/trunk@36573


git-svn-id: http://core.svn.wordpress.org/trunk@36540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-18 17:16:27 +00:00
Andrea Fercia
62d8fda8dd After [36171] remove all the occurrences of the old CSS clearfix.
The old clearfix was applied to very specific items and defined multiple times
across CSS files. Uses the new generic `.wp-clearfix` utility class instead.

See #26396.
Built from https://develop.svn.wordpress.org/trunk@36422


git-svn-id: http://core.svn.wordpress.org/trunk@36389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-30 13:46:27 +00:00
Weston Ruter
c376477265 Customizer: Export nonce, theme, and url app settings in preview as exported in pane.
* Introduce `WP_Customize_Manager::get_nonces()` to consolidate logic for retrieving nonces.
* Export nonces centrally in `wp.customize.settings.nonce` with each request and update nav menus preview to utilize.
* Send updated nonces to preview upon `nonce-refresh`.
* Request full preview refresh if Nav Menu selective refresh request fails (e.g. due to bad nonce).
* Update nav menus and widgets in Customizer to utilize `customize_refresh_nonces` for exporting nonces and keeping them up to date.

See #27355.
Fixes #35617.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-27 17:55:26 +00:00
Weston Ruter
fb8544a0ac Customizer: Add shift-click on nav menu items in preview to focus on corresponding nav menu item controls in pane.
Add missing `params.completeCallback` to `MenuItemControl.focus()` for parity with `Control.focus()`. Also adds `params` to `MenuItemControl.expandForm`, `MenuItemControl.collapseForm()`, and `MenuItemControl.toggleForm()`.

Props MattGeri, westonruter.
Fixes #32681.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-22 21:21:26 +00:00
Andrea Fercia
450cbb3e81 Accessibility: Remove title attributes from the Menus screen.
Also, adds missing labels and improves the existing ones. 
Updates the "custom links" labels and inputs in the Customizer too.
Introduces a generic, reusable, `.wp-initial-focus` CSS class to be used for
the sole purpose of setting the initial focus.
"Quick Search": uniform the attached events and avoids new AJAX requests to
be triggered when the pressed key doesn't change the searched term.

Fixes #35374.
Built from https://develop.svn.wordpress.org/trunk@36379


git-svn-id: http://core.svn.wordpress.org/trunk@36346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-22 14:26:27 +00:00
Sergey Biryukov
17af54fc7c Customizer: Use correct context and translator comments for menu location strings.
See #33431.
Built from https://develop.svn.wordpress.org/trunk@35722


git-svn-id: http://core.svn.wordpress.org/trunk@35686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 17:46:25 +00:00
Dominik Schilling
dfd30b10b0 Customizer: Remove two unused strings.
Fixes #33632.
Built from https://develop.svn.wordpress.org/trunk@35694


git-svn-id: http://core.svn.wordpress.org/trunk@35658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 22:12:26 +00:00
Scott Taylor
a9fb6e9ae0 Customizer i18n: provide translator context for current menu name and location.
Props ryankienstra.
Fixes #33431.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-18 19:21:28 +00:00
Helen Hou-Sandí
ae9e173082 Buttons: Standardize on .button-link for link-like buttons.
This serves as both a reset and some basic styling. The class name also aligns with parallel components in other popular projects.

props paulwilde for the initial patch.
fixes #34242.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-13 15:47:27 +00:00
Weston Ruter
154e3d4593 Customize: Simplify condition for returning nav_menus_invalid_post_type error.
Props swissspidy.
See #16075.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-04 07:29:25 +00:00
Weston Ruter
77e365efbf Customize: Add support for post_type_archive nav menu items.
Props celloexpressions, westonruter.
Fixes #16075.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-04 04:30:26 +00:00
Dominik Schilling
833e92b7da Customizer: Use the plural label for available menu item types.
Fixes #33634.
Built from https://develop.svn.wordpress.org/trunk@34487


git-svn-id: http://core.svn.wordpress.org/trunk@34451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 09:16:25 +00:00
Weston Ruter
88c1ab7c74 Customize: Fix live previewing of menu changes on subdirectory installs.
Props adamsilverstein, westonruter.
Fixes #33916.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-18 05:47:27 +00:00
Sergey Biryukov
b4a5dd59f3 Customizer: Use existing decoupled strings in Menu Locations section. See [31941] and [31951].
props egill.
fixes #33416.
Built from https://develop.svn.wordpress.org/trunk@33741


git-svn-id: http://core.svn.wordpress.org/trunk@33709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 21:53:20 +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
Helen Hou-Sandí
ea8f8acc79 Menu customizer: More clearly separate search results from available items.
Available items now fade from view while you're searching, and there is an explicit way to clear search results. No results gives a better message, though still brief this time around.

props valendesigns, designsimply, DH-Shredder, helen.
fixes #32710.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 23:40:25 +00:00
Weston Ruter
bdc30ce968 Customizer: Remove redundant translated string.
Props obenland.
Fixes #33183.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-29 18:53:25 +00:00
Dominik Schilling
fd320b5c6e Customizer: Make a string translatable, see [33413].
see #32715.
Built from https://develop.svn.wordpress.org/trunk@33460


git-svn-id: http://core.svn.wordpress.org/trunk@33427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-28 13:25:25 +00:00
Sergey Biryukov
275f10e78e Customizer: Set a correct default for nav_menu_locations setting.
props westonruter.
fixes #33088.
Built from https://develop.svn.wordpress.org/trunk@33421


git-svn-id: http://core.svn.wordpress.org/trunk@33389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-26 02:01:25 +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
Weston Ruter
910092531b Customizer: Indicate when there are no nav menu items available for a given type.
Props celloexpressions, valendesigns, rittesh.patel.
Fixes #32810.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-19 00:06:24 +00:00
Weston Ruter
afd7a8e836 Customizer: Finish unit tests for nav menus.
Removes object_type restriction to allow for future extensibility. Refactors some methods to improve testability. Includes new tests for Ajax requests.

Fixes #32687.
Props valendesigns, welcher, westonruter.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-18 23:20:25 +00:00
Weston Ruter
c5bd85552e Customizer: Improve performance of menus by caching results of wp_setup_nav_menu_item() calls.
Also fixes property list in phpdoc for `wp_setup_nav_menu_item()`.

Fixes #32769.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-14 07:09:24 +00:00
Drew Jaynes
65a4946d9a Fix syntax and add missing @access tags to various methods in WP_Customize_Nav_Menus, added in 4.3.
See [32806]. See #32891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 20:39:25 +00:00
Dominik Schilling
72b383b3d4 Customizer: Fix broken cap check in WP_Customize_Nav_Menus::ajax_search_available_items.
see #33163.
Built from https://develop.svn.wordpress.org/trunk@33191


git-svn-id: http://core.svn.wordpress.org/trunk@33163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 14:31:24 +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
b0bdcf3a58 Customizer: Remove unused string.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@33167


git-svn-id: http://core.svn.wordpress.org/trunk@33139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-11 20:53:24 +00:00
Dominik Schilling
cb2782aaa0 Customizer: Replace non-visible error messages for nav menus with error codes.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@33163


git-svn-id: http://core.svn.wordpress.org/trunk@33135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-11 20:00:24 +00:00
Dominik Schilling
bff15bf681 Customizer: Improve markup for available menu items.
* Use lists for available menu items.
* Remove unused template for available item types.
* Hide the type label and title from screen readers and instead include them in the add button.

props celloexpressions, afercia.
fixes #32724.
Built from https://develop.svn.wordpress.org/trunk@33151


git-svn-id: http://core.svn.wordpress.org/trunk@33123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-09 22:00:25 +00:00
Weston Ruter
3e58b38b28 Customizer: Remove additional wrapper element around wp_nav_menu() which broke some theme designs.
Also includes these related changes:
* Export `oldContainer` and `newContainer` among the `customize-preview-menu-refreshed` event params for themes to be able to more easily re-initialize the DOM elements.
* Improve performance for partial refresh by only sending settings related to the menu being previewed.
* Fix previewing of menu assigned to Custom Menu by exporting a menu `term_id` as opposed to an object, as the former is more stable for comparing in in args hashes.
* Do full refresh of preview when nav menu unassigned so that the layout can be updated.
* Harden conditions for when partial refresh is eligible for a `wp_nav_menu()` instance.

Fixes #32841.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-08 21:30:24 +00:00
Weston Ruter
9e26f1db4c Customizer: Prevent loss of walker and fallback_cb args for wp_nav_menu.
These args only need to be cleared out when exported to JavaScript, when they are not JSON-serializable. So the filter now clears these when gathering args for exporting to JS, but otherwise now leaves the original values to be passed through to `wp_nav_menu()`.

Fixes #32781.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-08 20:18:27 +00:00
Weston Ruter
a62cc940ea Customizer: Register controls and settings for nav_menu_locations even when there are no menus yet.
This change ensures that the first menu created can be assigned to a location without first saving and reloading the Customizer.

Props markoheijnen.
Fixes #32858.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-06 19:13:25 +00:00
Weston Ruter
a3c1814cc2 Customizer: Ensure that a newly-added nav menu item gets the Original link populated in its control.
Props valendesigns.
Fixes #32858.


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


git-svn-id: http://core.svn.wordpress.org/trunk@33060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-06 05:53: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
Weston Ruter
912b434198 Customizer: Fix saving menus with empty names or names that are already used.
Adds validation for initially-supplied nav menu name, blocking empty names from being supplied. If later an empty name is supplied and the nav menu is saved, the name "(unnamed)" will be supplied instead and supplied back to the client. If a name is supplied for the menu which is currently used by another menu, then the name conflict is resolved by adding a numerical counter similar to how `post_name` conflicts are resolved. Includes unit tests.

Fixes #32760.


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


git-svn-id: http://core.svn.wordpress.org/trunk@33042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-03 20:47:25 +00:00
Weston Ruter
8f03622640 Customizer: Add link to Widgets panel from Menus panel description.
Props celloexpressions.
Fixes #32742.


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


git-svn-id: http://core.svn.wordpress.org/trunk@33007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 19:35:25 +00:00
Sergey Biryukov
52db28396c Customizer: Avoid PHP notices after [32806].
props adamsilverstein, westonruter.
fixes #32781.
Built from https://develop.svn.wordpress.org/trunk@33035


git-svn-id: http://core.svn.wordpress.org/trunk@33006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 19:08:24 +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
f127478bde Customizer: Improve handling of posts with no title.
Use the `#%d (no title)` string as a fallback which is already used on the nav menus screen.
Add a translator comment to all occurrences of the `#%d (no title)` string.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 19:50:26 +00:00
Dominik Schilling
baeadbb6fb Customizer: Accessibility improvements for menu item searches.
* Add a description and an `aria-describedby` attribute to inform users this is a "live" search.
* Announce the number of search results via `wp.a11y.speak`.
* Use `aria-busy` attribute to stop screen readers announcing content while the "loading more results" is running.
* Increase the search debounce wait interval to 500ms to be consistent with other live searches.
* If a search fails don't call `wp.a11y.speak` with an undefined variable.

props afercia.
see #32720.
Built from https://develop.svn.wordpress.org/trunk@32891


git-svn-id: http://core.svn.wordpress.org/trunk@32862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 19:22: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
1d953f8258 Customizer: Make labels of the menu item reorder buttons translatable.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@32888


git-svn-id: http://core.svn.wordpress.org/trunk@32859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 18:40:25 +00:00
Dominik Schilling
8fe9d04bf9 Customizer: Replace wrong usage of _x() with translator comments.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@32887


git-svn-id: http://core.svn.wordpress.org/trunk@32858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 18:33:26 +00:00
Dominik Schilling
5c2d8c6b07 Customizer: Rename label for custom links to "Custom Links", see [31748].
props paulwilde
fixes #32732.
Built from https://develop.svn.wordpress.org/trunk@32886


git-svn-id: http://core.svn.wordpress.org/trunk@32857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 18:29:26 +00:00
Scott Taylor
dd2ec86e87 Add missing access modifiers to WP_Customize_Nav_Menus.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 22:04:28 +00:00