diff --git a/backport-changelog/7.2/13625.md b/backport-changelog/7.2/13625.md new file mode 100644 index 00000000000000..0c0d19a36d7a90 --- /dev/null +++ b/backport-changelog/7.2/13625.md @@ -0,0 +1,4 @@ +https://github.com/WordPress/wordpress-develop/pull/13625 + +* https://github.com/WordPress/gutenberg/pull/83261 +* https://github.com/WordPress/gutenberg/pull/83277 diff --git a/backport-changelog/7.2/13633.md b/backport-changelog/7.2/13633.md deleted file mode 100644 index fc8e9ad8ca5e99..00000000000000 --- a/backport-changelog/7.2/13633.md +++ /dev/null @@ -1,3 +0,0 @@ -https://github.com/WordPress/wordpress-develop/pull/13633 - -* https://github.com/WordPress/gutenberg/pull/83277 diff --git a/lib/class-wp-icons-registry-gutenberg.php b/lib/class-wp-icons-registry-gutenberg.php index 39b2794ff83481..9bd3784a1ce97a 100644 --- a/lib/class-wp-icons-registry-gutenberg.php +++ b/lib/class-wp-icons-registry-gutenberg.php @@ -364,7 +364,7 @@ public function get_registered_icons( $search = '' ) { * The base `$instance` slot is intentionally not redefined, so both * `WP_Icons_Registry::get_instance()` (used by core) and this method share * one instance. An existing base registry is upgraded, replaying any - * non-`core/` icons so they are not lost. + * non-`core/` and non-`core-admin/` icons so they are not lost. */ public static function get_instance() { if ( ! self::$instance instanceof self ) { @@ -373,7 +373,7 @@ public static function get_instance() { if ( null !== $original_registry ) { foreach ( $original_registry->get_registered_icons() as $icon ) { - if ( str_starts_with( $icon['name'], 'core/' ) ) { + if ( str_starts_with( $icon['name'], 'core/' ) || str_starts_with( $icon['name'], 'core-admin/' ) ) { continue; } $icon_properties = array( 'label' => $icon['label'] ); diff --git a/lib/icons.php b/lib/icons.php index 6732ea0907ce36..84b64c4ec4e39b 100644 --- a/lib/icons.php +++ b/lib/icons.php @@ -1,6 +1,6 @@ __( 'Core icon collection.', 'gutenberg' ), ) ); + wp_register_icon_collection( + 'core-admin', + array( + 'label' => __( 'WordPress Admin', 'gutenberg' ), + 'description' => __( 'Icon collection used by the WordPress admin interface.', 'gutenberg' ), + 'public' => false, + ) + ); } $default_icon_collections_priority = has_action( 'init', '_wp_register_default_icon_collections' ); @@ -26,7 +34,7 @@ function gutenberg_register_default_icon_collections() { add_action( 'init', 'gutenberg_register_default_icon_collections', 0 ); /** - * Registers the default core icons from the Gutenberg manifest. + * Registers the default core and core-admin icons from the Gutenberg manifest. */ function gutenberg_register_default_icons() { $icons_directory = gutenberg_dir_path() . 'packages/icons/src'; @@ -64,12 +72,23 @@ function gutenberg_register_default_icons() { return; } + if ( empty( $icon_data['collections'] ) || ! is_array( $icon_data['collections'] ) ) { + _doing_it_wrong( + __FUNCTION__, + __( 'Core icon collection manifest must provide a non-empty "collections" array for each icon.', 'gutenberg' ), + '7.2.0' + ); + return; + } + $icon_args = array( 'label' => $icon_data['label'], 'file_path' => $icons_directory . $icon_data['filePath'], ); - wp_register_icon( 'core/' . $icon_name, $icon_args ); + foreach ( $icon_data['collections'] as $collection_slug ) { + wp_register_icon( $collection_slug . '/' . $icon_name, $icon_args ); + } } } diff --git a/packages/icons/CHANGELOG.md b/packages/icons/CHANGELOG.md index bc0a4361c53441..b8dc6a14d1f79a 100644 --- a/packages/icons/CHANGELOG.md +++ b/packages/icons/CHANGELOG.md @@ -12,6 +12,7 @@ - `manifest.json`: The `public` property is now a tri-state. Omitting it keeps an icon in the JS library only; `true` ships it to WordPress Core and exposes it through the icons REST API, making it selectable in the Icon block; `false` ships it and registers it in the `core` collection for server-side use via `wp_get_icon()`, while hiding it from the REST API and the Icon block. ([#82634](https://github.com/WordPress/gutenberg/pull/82634)) - The `brush`, `dashboard`, `link`, `media`, `page`, `pin`, `plugins`, `sites`, `tool`, `update` and `wordpress` icons now ship to WordPress Core as non-public icons: they are registered in the `core` collection and stay available to server-side code via `wp_get_icon()`, but are not exposed through the icons REST API and are not selectable in the Icon block. ([#82634](https://github.com/WordPress/gutenberg/pull/82634), [#79451](https://github.com/WordPress/gutenberg/pull/79451)) - `manifest.json`: The `public` field now only controls whether an icon ships to WordPress Core ([#83277](https://github.com/WordPress/gutenberg/pull/83277)). +- `manifest.json`: New `collections` property, listing the collections an icon is registered in once it ships to WordPress Core. It replaces the `public` property and introduces the `core-admin` collection, which is not public and holds the icons the WordPress admin interface renders. ([#83261](https://github.com/WordPress/gutenberg/pull/83261), [#79451](https://github.com/WordPress/gutenberg/pull/79451)) ### Bug Fixes diff --git a/packages/icons/README.md b/packages/icons/README.md index 4209a53cf78153..bb0de5523aae89 100644 --- a/packages/icons/README.md +++ b/packages/icons/README.md @@ -50,7 +50,9 @@ To add a new icon to the library, follow these steps: - `slug`: The icon identifier (should match the SVG filename without the `.svg` extension) - `label`: The human-readable label for the icon. Use Title Case (for example, `My New Icon`). - `filePath`: The relative path to the SVG file (e.g., `library/my-new-icon.svg`) - - `public` (optional): Set to `true` to ship the icon to WordPress Core and register it in the `core` collection. Omit it to keep the icon in the JS library only. **Important**: Once an icon ships to WordPress Core, removing it is difficult, so carefully consider this field before setting it. + - `collections` (optional): The collections the icon is registered in once it ships to WordPress Core. Omit it to keep the icon in the JS library only. **Important**: Once an icon ships to WordPress Core, removing it is difficult, so carefully consider this field before setting it. The available collections are: + - `core`: the public collection. Its icons are exposed through the SVG Icons API, which makes them selectable in the Icon block. + - `core-admin`: the collection the WordPress admin interface renders from. It is not public, so its icons are never exposed through the REST API or selectable in the Icon block, and unregistering `core` cannot take them away from the admin interface. 4. **Do not edit `manifest.php`**: The `manifest.php` file is automatically generated from `manifest.json` by the build script. Do not edit it manually, as your changes will be overwritten when the build runs. diff --git a/packages/icons/lib/generate-manifest-php.cjs b/packages/icons/lib/generate-manifest-php.cjs index 8b33091f6f0b59..ba4a4527ee8476 100644 --- a/packages/icons/lib/generate-manifest-php.cjs +++ b/packages/icons/lib/generate-manifest-php.cjs @@ -42,10 +42,14 @@ function generatePHPArray( manifest ) { const key = formatPHPKey( item.slug, maxKeyLength ); const label = escapePHPString( item.label ); const filePath = escapePHPString( item.filePath ); + const collections = item.collections + .map( ( collection ) => `'${ escapePHPString( collection ) }'` ) + .join( ', ' ); return `${ key } => array( - 'label' => _x( '${ label }', 'icon label', 'gutenberg' ), - 'filePath' => '${ filePath }', + 'label' => _x( '${ label }', 'icon label', 'gutenberg' ), + 'filePath' => '${ filePath }', + 'collections' => array( ${ collections } ), ),`; } ); @@ -56,12 +60,15 @@ ${ phpEntries.join( '\n' ) } /** * Generates manifest.php from manifest.json. - * Only includes icons which have `public` set to true. + * Only includes icons which belong to at least one collection, since those are + * the icons shipped to WordPress Core. */ async function generateManifestPHP() { const manifestJson = await readFile( MANIFEST_JSON_PATH, 'utf8' ); const manifest = JSON.parse( manifestJson ); - const includedIcons = manifest.filter( ( item ) => item.public === true ); + const includedIcons = manifest.filter( + ( item ) => item.collections?.length > 0 + ); const phpHeader = `]*>/ )?.[ 0 ]; return /\sstyle=(["'])fill\s*:\s*none\s*;?\s*\1/.test( svgTag ?? '' ); @@ -13,7 +16,8 @@ function isStrokeBasedSvg( svgContent ) { * Validating the icons collection checks that: * * - Each manifest entry has a matching SVG in library/, and vice versa. - * - Each manifest entry's `public` property, if present, is a boolean. + * - Each manifest entry's `collections` property, if present, is a non-empty array of + * known collection slugs. * - Each SVG uses currentColor so icons inherit text color. * - Each SVG uses viewBox="0 0 24 24". * - Each stroke-based SVG contains at least one stroked graphical element. @@ -62,16 +66,28 @@ async function validateCollection() { manifestPaths.push( icon.filePath ); /* - * Verify that `public`, if present, is a boolean. + * Verify that `collections`, if present, lists known collection slugs. An icon + * without the property stays in the JS library and is not shipped to core. */ - if ( 'public' in icon && typeof icon.public !== 'boolean' ) { - problems.push( - `- Invalid icon definition for icon '${ - icon.slug - }': expected 'public' to be true or false, saw ${ JSON.stringify( - icon.public - ) }` - ); + if ( 'collections' in icon ) { + const { collections } = icon; + const isValid = + Array.isArray( collections ) && + collections.length > 0 && + collections.every( ( collection ) => + VALID_ICON_COLLECTIONS.includes( collection ) + ) && + new Set( collections ).size === collections.length; + + if ( ! isValid ) { + problems.push( + `- Invalid icon definition for icon '${ + icon.slug + }': expected 'collections' to be a non-empty array of unique slugs out of ${ VALID_ICON_COLLECTIONS.map( + ( collection ) => `'${ collection }'` + ).join( ', ' ) }, saw ${ JSON.stringify( collections ) }` + ); + } } /* diff --git a/packages/icons/src/manifest.json b/packages/icons/src/manifest.json index 40f1c09e87be83..4dcf35ca04a24a 100644 --- a/packages/icons/src/manifest.json +++ b/packages/icons/src/manifest.json @@ -63,49 +63,49 @@ "slug": "arrow-down-left", "label": "Arrow Down Left", "filePath": "library/arrow-down-left.svg", - "public": true + "collections": [ "core" ] }, { "slug": "arrow-down-right", "label": "Arrow Down Right", "filePath": "library/arrow-down-right.svg", - "public": true + "collections": [ "core" ] }, { "slug": "arrow-down", "label": "Arrow Down", "filePath": "library/arrow-down.svg", - "public": true + "collections": [ "core" ] }, { "slug": "arrow-left", "label": "Arrow Left", "filePath": "library/arrow-left.svg", - "public": true + "collections": [ "core" ] }, { "slug": "arrow-right", "label": "Arrow Right", "filePath": "library/arrow-right.svg", - "public": true + "collections": [ "core" ] }, { "slug": "arrow-up-left", "label": "Arrow Up Left", "filePath": "library/arrow-up-left.svg", - "public": true + "collections": [ "core" ] }, { "slug": "arrow-up-right", "label": "Arrow Up Right", "filePath": "library/arrow-up-right.svg", - "public": true + "collections": [ "core" ] }, { "slug": "arrow-up", "label": "Arrow Up", "filePath": "library/arrow-up.svg", - "public": true + "collections": [ "core" ] }, { "slug": "aspect-ratio", @@ -116,13 +116,13 @@ "slug": "at-symbol", "label": "At Symbol (@)", "filePath": "library/at-symbol.svg", - "public": true + "collections": [ "core" ] }, { "slug": "audio", "label": "Audio", "filePath": "library/audio.svg", - "public": true + "collections": [ "core" ] }, { "slug": "background", @@ -138,7 +138,7 @@ "slug": "bell", "label": "Bell", "filePath": "library/bell.svg", - "public": true + "collections": [ "core" ] }, { "slug": "bell-unread", @@ -149,19 +149,19 @@ "slug": "block-default", "label": "Block Default", "filePath": "library/block-default.svg", - "public": true + "collections": [ "core" ] }, { "slug": "block-meta", "label": "Block Meta", "filePath": "library/block-meta.svg", - "public": true + "collections": [ "core" ] }, { "slug": "block-table", "label": "Block Table", "filePath": "library/block-table.svg", - "public": true + "collections": [ "core" ] }, { "slug": "border", @@ -181,7 +181,8 @@ { "slug": "brush", "label": "Brush", - "filePath": "library/brush.svg" + "filePath": "library/brush.svg", + "collections": [ "core-admin" ] }, { "slug": "bug", @@ -202,7 +203,7 @@ "slug": "calendar", "label": "Calendar", "filePath": "library/calendar.svg", - "public": true + "collections": [ "core" ] }, { "slug": "cancel-circle-filled", @@ -218,31 +219,31 @@ "slug": "capture-photo", "label": "Capture Photo", "filePath": "library/capture-photo.svg", - "public": true + "collections": [ "core" ] }, { "slug": "capture-video", "label": "Capture Video", "filePath": "library/capture-video.svg", - "public": true + "collections": [ "core" ] }, { "slug": "cart", "label": "Cart", "filePath": "library/cart.svg", - "public": true + "collections": [ "core" ] }, { "slug": "category", "label": "Category", "filePath": "library/category.svg", - "public": true + "collections": [ "core" ] }, { "slug": "caution", "label": "Caution", "filePath": "library/caution.svg", - "public": true + "collections": [ "core" ] }, { "slug": "caution-filled", @@ -253,67 +254,67 @@ "slug": "chart-bar", "label": "Chart Bar", "filePath": "library/chart-bar.svg", - "public": true + "collections": [ "core" ] }, { "slug": "check", "label": "Check", "filePath": "library/check.svg", - "public": true + "collections": [ "core" ] }, { "slug": "chevron-down", "label": "Chevron Down", "filePath": "library/chevron-down.svg", - "public": true + "collections": [ "core" ] }, { "slug": "chevron-down-small", "label": "Chevron Down Small", "filePath": "library/chevron-down-small.svg", - "public": true + "collections": [ "core" ] }, { "slug": "chevron-left", "label": "Chevron Left", "filePath": "library/chevron-left.svg", - "public": true + "collections": [ "core", "core-admin" ] }, { "slug": "chevron-left-small", "label": "Chevron Left Small", "filePath": "library/chevron-left-small.svg", - "public": true + "collections": [ "core" ] }, { "slug": "chevron-right", "label": "Chevron Right", "filePath": "library/chevron-right.svg", - "public": true + "collections": [ "core" ] }, { "slug": "chevron-right-small", "label": "Chevron Right Small", "filePath": "library/chevron-right-small.svg", - "public": true + "collections": [ "core" ] }, { "slug": "chevron-up", "label": "Chevron Up", "filePath": "library/chevron-up.svg", - "public": true + "collections": [ "core" ] }, { "slug": "chevron-up-down", "label": "Chevron Up Down", "filePath": "library/chevron-up-down.svg", - "public": true + "collections": [ "core" ] }, { "slug": "chevron-up-small", "label": "Chevron Up Small", "filePath": "library/chevron-up-small.svg", - "public": true + "collections": [ "core" ] }, { "slug": "classic", @@ -374,7 +375,7 @@ "slug": "comment", "label": "Comment", "filePath": "library/comment.svg", - "public": true + "collections": [ "core", "core-admin" ] }, { "slug": "comment-author-avatar", @@ -445,13 +446,13 @@ "slug": "cover", "label": "Cover", "filePath": "library/cover.svg", - "public": true + "collections": [ "core" ] }, { "slug": "create", "label": "Create", "filePath": "library/create.svg", - "public": true + "collections": [ "core" ] }, { "slug": "contents", @@ -491,13 +492,14 @@ { "slug": "dashboard", "label": "Dashboard", - "filePath": "library/dashboard.svg" + "filePath": "library/dashboard.svg", + "collections": [ "core-admin" ] }, { "slug": "desktop", "label": "Desktop", "filePath": "library/desktop.svg", - "public": true + "collections": [ "core" ] }, { "slug": "details", @@ -508,7 +510,7 @@ "slug": "download", "label": "Download", "filePath": "library/download.svg", - "public": true + "collections": [ "core" ] }, { "slug": "drafts", @@ -524,37 +526,37 @@ "slug": "drawer-left", "label": "Drawer Left", "filePath": "library/drawer-left.svg", - "public": true + "collections": [ "core" ] }, { "slug": "drawer-right", "label": "Drawer Right", "filePath": "library/drawer-right.svg", - "public": true + "collections": [ "core" ] }, { "slug": "envelope", "label": "Envelope", "filePath": "library/envelope.svg", - "public": true + "collections": [ "core" ] }, { "slug": "error", "label": "Error", "filePath": "library/error.svg", - "public": true + "collections": [ "core" ] }, { "slug": "external", "label": "External", "filePath": "library/external.svg", - "public": true + "collections": [ "core" ] }, { "slug": "file", "label": "File", "filePath": "library/file.svg", - "public": true + "collections": [ "core" ] }, { "slug": "filter", @@ -680,7 +682,7 @@ "slug": "gallery", "label": "Gallery", "filePath": "library/gallery.svg", - "public": true + "collections": [ "core" ] }, { "slug": "gift", @@ -701,7 +703,7 @@ "slug": "group", "label": "Group", "filePath": "library/group.svg", - "public": true + "collections": [ "core" ] }, { "slug": "handle", @@ -717,7 +719,7 @@ "slug": "heading", "label": "Heading", "filePath": "library/heading.svg", - "public": true + "collections": [ "core" ] }, { "slug": "heading-level-1", @@ -753,7 +755,7 @@ "slug": "help", "label": "Help", "filePath": "library/help.svg", - "public": true + "collections": [ "core" ] }, { "slug": "help-filled", @@ -764,7 +766,7 @@ "slug": "home", "label": "Home", "filePath": "library/home.svg", - "public": true + "collections": [ "core", "core-admin" ] }, { "slug": "home-button", @@ -780,7 +782,7 @@ "slug": "image", "label": "Image", "filePath": "library/image.svg", - "public": true + "collections": [ "core" ] }, { "slug": "inbox", @@ -791,7 +793,7 @@ "slug": "info", "label": "Info", "filePath": "library/info.svg", - "public": true + "collections": [ "core" ] }, { "slug": "inline-image", @@ -867,7 +869,7 @@ "slug": "key", "label": "Key", "filePath": "library/key.svg", - "public": true + "collections": [ "core" ] }, { "slug": "keyboard", @@ -888,7 +890,7 @@ "slug": "language", "label": "Language", "filePath": "library/language.svg", - "public": true + "collections": [ "core" ] }, { "slug": "layout", @@ -923,7 +925,8 @@ { "slug": "link", "label": "Link", - "filePath": "library/link.svg" + "filePath": "library/link.svg", + "collections": [ "core-admin" ] }, { "slug": "link-off", @@ -974,7 +977,7 @@ "slug": "map-marker", "label": "Map Marker", "filePath": "library/map-marker.svg", - "public": true + "collections": [ "core" ] }, { "slug": "math", @@ -984,7 +987,8 @@ { "slug": "media", "label": "Media", - "filePath": "library/media.svg" + "filePath": "library/media.svg", + "collections": [ "core-admin" ] }, { "slug": "media-and-text", @@ -1000,13 +1004,13 @@ "slug": "menu", "label": "Menu", "filePath": "library/menu.svg", - "public": true + "collections": [ "core", "core-admin" ] }, { "slug": "mobile", "label": "Mobile", "filePath": "library/mobile.svg", - "public": true + "collections": [ "core" ] }, { "slug": "more", @@ -1017,13 +1021,13 @@ "slug": "more-horizontal", "label": "More Horizontal", "filePath": "library/more-horizontal.svg", - "public": true + "collections": [ "core" ] }, { "slug": "more-vertical", "label": "More Vertical", "filePath": "library/more-vertical.svg", - "public": true + "collections": [ "core" ] }, { "slug": "move-to", @@ -1044,7 +1048,7 @@ "slug": "next", "label": "Next", "filePath": "library/next.svg", - "public": true + "collections": [ "core" ] }, { "slug": "not-allowed", @@ -1069,7 +1073,8 @@ { "slug": "page", "label": "Page", - "filePath": "library/page.svg" + "filePath": "library/page.svg", + "collections": [ "core-admin" ] }, { "slug": "page-break", @@ -1085,7 +1090,7 @@ "slug": "paragraph", "label": "Paragraph", "filePath": "library/paragraph.svg", - "public": true + "collections": [ "core" ] }, { "slug": "pause", @@ -1096,13 +1101,13 @@ "slug": "payment", "label": "Payment", "filePath": "library/payment.svg", - "public": true + "collections": [ "core" ] }, { "slug": "pencil", "label": "Pencil", "filePath": "library/pencil.svg", - "public": true + "collections": [ "core", "core-admin" ] }, { "slug": "pending", @@ -1113,7 +1118,7 @@ "slug": "people", "label": "People", "filePath": "library/people.svg", - "public": true + "collections": [ "core", "core-admin" ] }, { "slug": "percent", @@ -1123,7 +1128,8 @@ { "slug": "pin", "label": "Pin", - "filePath": "library/pin.svg" + "filePath": "library/pin.svg", + "collections": [ "core-admin" ] }, { "slug": "pin-small", @@ -1133,7 +1139,8 @@ { "slug": "plugins", "label": "Plugins", - "filePath": "library/plugins.svg" + "filePath": "library/plugins.svg", + "collections": [ "core-admin" ] }, { "slug": "play", @@ -1154,13 +1161,13 @@ "slug": "plus", "label": "Plus", "filePath": "library/plus.svg", - "public": true + "collections": [ "core", "core-admin" ] }, { "slug": "plus-circle", "label": "Plus Circle", "filePath": "library/plus-circle.svg", - "public": true + "collections": [ "core" ] }, { "slug": "plus-circle-filled", @@ -1251,13 +1258,13 @@ "slug": "previous", "label": "Previous", "filePath": "library/previous.svg", - "public": true + "collections": [ "core" ] }, { "slug": "published", "label": "Published", "filePath": "library/published.svg", - "public": true + "collections": [ "core" ] }, { "slug": "pull-left", @@ -1298,13 +1305,13 @@ "slug": "quote", "label": "Quote", "filePath": "library/quote.svg", - "public": true + "collections": [ "core" ] }, { "slug": "receipt", "label": "Receipt", "filePath": "library/receipt.svg", - "public": true + "collections": [ "core" ] }, { "slug": "redo", @@ -1375,19 +1382,19 @@ "slug": "rss", "label": "RSS", "filePath": "library/rss.svg", - "public": true + "collections": [ "core" ] }, { "slug": "scheduled", "label": "Scheduled", "filePath": "library/scheduled.svg", - "public": true + "collections": [ "core" ] }, { "slug": "search", "label": "Search", "filePath": "library/search.svg", - "public": true + "collections": [ "core", "core-admin" ] }, { "slug": "seen", @@ -1408,25 +1415,25 @@ "slug": "settings", "label": "Settings", "filePath": "library/settings.svg", - "public": true + "collections": [ "core", "core-admin" ] }, { "slug": "shadow", "label": "Shadow", "filePath": "library/shadow.svg", - "public": true + "collections": [ "core" ] }, { "slug": "share", "label": "Share", "filePath": "library/share.svg", - "public": true + "collections": [ "core" ] }, { "slug": "shield", "label": "Shield", "filePath": "library/shield.svg", - "public": true + "collections": [ "core" ] }, { "slug": "shipping", @@ -1442,7 +1449,7 @@ "slug": "shuffle", "label": "Shuffle", "filePath": "library/shuffle.svg", - "public": true + "collections": [ "core" ] }, { "slug": "sidebar", @@ -1507,7 +1514,8 @@ { "slug": "sites", "label": "Sites", - "filePath": "library/sites.svg" + "filePath": "library/sites.svg", + "collections": [ "core-admin" ] }, { "slug": "square", @@ -1523,25 +1531,25 @@ "slug": "star-empty", "label": "Star Empty", "filePath": "library/star-empty.svg", - "public": true + "collections": [ "core" ] }, { "slug": "star-filled", "label": "Star Filled", "filePath": "library/star-filled.svg", - "public": true + "collections": [ "core" ] }, { "slug": "star-half", "label": "Star Half", "filePath": "library/star-half.svg", - "public": true + "collections": [ "core" ] }, { "slug": "store", "label": "Store", "filePath": "library/store.svg", - "public": true + "collections": [ "core" ] }, { "slug": "stretch-full-width", @@ -1557,7 +1565,7 @@ "slug": "styles", "label": "Styles", "filePath": "library/styles.svg", - "public": true + "collections": [ "core" ] }, { "slug": "subscript", @@ -1578,19 +1586,19 @@ "slug": "symbol", "label": "Symbol", "filePath": "library/symbol.svg", - "public": true + "collections": [ "core" ] }, { "slug": "symbol-filled", "label": "Symbol Filled", "filePath": "library/symbol-filled.svg", - "public": true + "collections": [ "core" ] }, { "slug": "table", "label": "Table", "filePath": "library/table.svg", - "public": true + "collections": [ "core" ] }, { "slug": "table-column-after", @@ -1631,7 +1639,7 @@ "slug": "tablet", "label": "Tablet", "filePath": "library/tablet.svg", - "public": true + "collections": [ "core" ] }, { "slug": "tab-list", @@ -1652,7 +1660,7 @@ "slug": "tag", "label": "Tag", "filePath": "library/tag.svg", - "public": true + "collections": [ "core" ] }, { "slug": "term-count", @@ -1703,7 +1711,7 @@ "slug": "tip", "label": "Tip", "filePath": "library/tip.svg", - "public": true + "collections": [ "core" ] }, { "slug": "title", @@ -1713,7 +1721,8 @@ { "slug": "tool", "label": "Tool", - "filePath": "library/tool.svg" + "filePath": "library/tool.svg", + "collections": [ "core-admin" ] }, { "slug": "trash", @@ -1758,19 +1767,20 @@ { "slug": "update", "label": "Update", - "filePath": "library/update.svg" + "filePath": "library/update.svg", + "collections": [ "core-admin" ] }, { "slug": "upload", "label": "Upload", "filePath": "library/upload.svg", - "public": true + "collections": [ "core" ] }, { "slug": "verse", "label": "Verse", "filePath": "library/verse.svg", - "public": true + "collections": [ "core" ] }, { "slug": "video", @@ -1790,6 +1800,7 @@ { "slug": "wordpress", "label": "WordPress", - "filePath": "library/wordpress.svg" + "filePath": "library/wordpress.svg", + "collections": [ "core-admin" ] } ] diff --git a/packages/icons/src/manifest.php b/packages/icons/src/manifest.php index d2eb04cff14e9f..df4940954b8346 100644 --- a/packages/icons/src/manifest.php +++ b/packages/icons/src/manifest.php @@ -6,355 +6,498 @@ return array( 'arrow-down-left' => array( - 'label' => _x( 'Arrow Down Left', 'icon label', 'gutenberg' ), - 'filePath' => 'library/arrow-down-left.svg', + 'label' => _x( 'Arrow Down Left', 'icon label', 'gutenberg' ), + 'filePath' => 'library/arrow-down-left.svg', + 'collections' => array( 'core' ), ), 'arrow-down-right' => array( - 'label' => _x( 'Arrow Down Right', 'icon label', 'gutenberg' ), - 'filePath' => 'library/arrow-down-right.svg', + 'label' => _x( 'Arrow Down Right', 'icon label', 'gutenberg' ), + 'filePath' => 'library/arrow-down-right.svg', + 'collections' => array( 'core' ), ), 'arrow-down' => array( - 'label' => _x( 'Arrow Down', 'icon label', 'gutenberg' ), - 'filePath' => 'library/arrow-down.svg', + 'label' => _x( 'Arrow Down', 'icon label', 'gutenberg' ), + 'filePath' => 'library/arrow-down.svg', + 'collections' => array( 'core' ), ), 'arrow-left' => array( - 'label' => _x( 'Arrow Left', 'icon label', 'gutenberg' ), - 'filePath' => 'library/arrow-left.svg', + 'label' => _x( 'Arrow Left', 'icon label', 'gutenberg' ), + 'filePath' => 'library/arrow-left.svg', + 'collections' => array( 'core' ), ), 'arrow-right' => array( - 'label' => _x( 'Arrow Right', 'icon label', 'gutenberg' ), - 'filePath' => 'library/arrow-right.svg', + 'label' => _x( 'Arrow Right', 'icon label', 'gutenberg' ), + 'filePath' => 'library/arrow-right.svg', + 'collections' => array( 'core' ), ), 'arrow-up-left' => array( - 'label' => _x( 'Arrow Up Left', 'icon label', 'gutenberg' ), - 'filePath' => 'library/arrow-up-left.svg', + 'label' => _x( 'Arrow Up Left', 'icon label', 'gutenberg' ), + 'filePath' => 'library/arrow-up-left.svg', + 'collections' => array( 'core' ), ), 'arrow-up-right' => array( - 'label' => _x( 'Arrow Up Right', 'icon label', 'gutenberg' ), - 'filePath' => 'library/arrow-up-right.svg', + 'label' => _x( 'Arrow Up Right', 'icon label', 'gutenberg' ), + 'filePath' => 'library/arrow-up-right.svg', + 'collections' => array( 'core' ), ), 'arrow-up' => array( - 'label' => _x( 'Arrow Up', 'icon label', 'gutenberg' ), - 'filePath' => 'library/arrow-up.svg', + 'label' => _x( 'Arrow Up', 'icon label', 'gutenberg' ), + 'filePath' => 'library/arrow-up.svg', + 'collections' => array( 'core' ), ), 'at-symbol' => array( - 'label' => _x( 'At Symbol (@)', 'icon label', 'gutenberg' ), - 'filePath' => 'library/at-symbol.svg', + 'label' => _x( 'At Symbol (@)', 'icon label', 'gutenberg' ), + 'filePath' => 'library/at-symbol.svg', + 'collections' => array( 'core' ), ), 'audio' => array( - 'label' => _x( 'Audio', 'icon label', 'gutenberg' ), - 'filePath' => 'library/audio.svg', + 'label' => _x( 'Audio', 'icon label', 'gutenberg' ), + 'filePath' => 'library/audio.svg', + 'collections' => array( 'core' ), ), 'bell' => array( - 'label' => _x( 'Bell', 'icon label', 'gutenberg' ), - 'filePath' => 'library/bell.svg', + 'label' => _x( 'Bell', 'icon label', 'gutenberg' ), + 'filePath' => 'library/bell.svg', + 'collections' => array( 'core' ), ), 'block-default' => array( - 'label' => _x( 'Block Default', 'icon label', 'gutenberg' ), - 'filePath' => 'library/block-default.svg', + 'label' => _x( 'Block Default', 'icon label', 'gutenberg' ), + 'filePath' => 'library/block-default.svg', + 'collections' => array( 'core' ), ), 'block-meta' => array( - 'label' => _x( 'Block Meta', 'icon label', 'gutenberg' ), - 'filePath' => 'library/block-meta.svg', + 'label' => _x( 'Block Meta', 'icon label', 'gutenberg' ), + 'filePath' => 'library/block-meta.svg', + 'collections' => array( 'core' ), ), 'block-table' => array( - 'label' => _x( 'Block Table', 'icon label', 'gutenberg' ), - 'filePath' => 'library/block-table.svg', + 'label' => _x( 'Block Table', 'icon label', 'gutenberg' ), + 'filePath' => 'library/block-table.svg', + 'collections' => array( 'core' ), + ), + 'brush' => array( + 'label' => _x( 'Brush', 'icon label', 'gutenberg' ), + 'filePath' => 'library/brush.svg', + 'collections' => array( 'core-admin' ), ), 'calendar' => array( - 'label' => _x( 'Calendar', 'icon label', 'gutenberg' ), - 'filePath' => 'library/calendar.svg', + 'label' => _x( 'Calendar', 'icon label', 'gutenberg' ), + 'filePath' => 'library/calendar.svg', + 'collections' => array( 'core' ), ), 'capture-photo' => array( - 'label' => _x( 'Capture Photo', 'icon label', 'gutenberg' ), - 'filePath' => 'library/capture-photo.svg', + 'label' => _x( 'Capture Photo', 'icon label', 'gutenberg' ), + 'filePath' => 'library/capture-photo.svg', + 'collections' => array( 'core' ), ), 'capture-video' => array( - 'label' => _x( 'Capture Video', 'icon label', 'gutenberg' ), - 'filePath' => 'library/capture-video.svg', + 'label' => _x( 'Capture Video', 'icon label', 'gutenberg' ), + 'filePath' => 'library/capture-video.svg', + 'collections' => array( 'core' ), ), 'cart' => array( - 'label' => _x( 'Cart', 'icon label', 'gutenberg' ), - 'filePath' => 'library/cart.svg', + 'label' => _x( 'Cart', 'icon label', 'gutenberg' ), + 'filePath' => 'library/cart.svg', + 'collections' => array( 'core' ), ), 'category' => array( - 'label' => _x( 'Category', 'icon label', 'gutenberg' ), - 'filePath' => 'library/category.svg', + 'label' => _x( 'Category', 'icon label', 'gutenberg' ), + 'filePath' => 'library/category.svg', + 'collections' => array( 'core' ), ), 'caution' => array( - 'label' => _x( 'Caution', 'icon label', 'gutenberg' ), - 'filePath' => 'library/caution.svg', + 'label' => _x( 'Caution', 'icon label', 'gutenberg' ), + 'filePath' => 'library/caution.svg', + 'collections' => array( 'core' ), ), 'chart-bar' => array( - 'label' => _x( 'Chart Bar', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chart-bar.svg', + 'label' => _x( 'Chart Bar', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chart-bar.svg', + 'collections' => array( 'core' ), ), 'check' => array( - 'label' => _x( 'Check', 'icon label', 'gutenberg' ), - 'filePath' => 'library/check.svg', + 'label' => _x( 'Check', 'icon label', 'gutenberg' ), + 'filePath' => 'library/check.svg', + 'collections' => array( 'core' ), ), 'chevron-down' => array( - 'label' => _x( 'Chevron Down', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chevron-down.svg', + 'label' => _x( 'Chevron Down', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chevron-down.svg', + 'collections' => array( 'core' ), ), 'chevron-down-small' => array( - 'label' => _x( 'Chevron Down Small', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chevron-down-small.svg', + 'label' => _x( 'Chevron Down Small', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chevron-down-small.svg', + 'collections' => array( 'core' ), ), 'chevron-left' => array( - 'label' => _x( 'Chevron Left', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chevron-left.svg', + 'label' => _x( 'Chevron Left', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chevron-left.svg', + 'collections' => array( 'core', 'core-admin' ), ), 'chevron-left-small' => array( - 'label' => _x( 'Chevron Left Small', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chevron-left-small.svg', + 'label' => _x( 'Chevron Left Small', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chevron-left-small.svg', + 'collections' => array( 'core' ), ), 'chevron-right' => array( - 'label' => _x( 'Chevron Right', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chevron-right.svg', + 'label' => _x( 'Chevron Right', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chevron-right.svg', + 'collections' => array( 'core' ), ), 'chevron-right-small' => array( - 'label' => _x( 'Chevron Right Small', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chevron-right-small.svg', + 'label' => _x( 'Chevron Right Small', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chevron-right-small.svg', + 'collections' => array( 'core' ), ), 'chevron-up' => array( - 'label' => _x( 'Chevron Up', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chevron-up.svg', + 'label' => _x( 'Chevron Up', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chevron-up.svg', + 'collections' => array( 'core' ), ), 'chevron-up-down' => array( - 'label' => _x( 'Chevron Up Down', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chevron-up-down.svg', + 'label' => _x( 'Chevron Up Down', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chevron-up-down.svg', + 'collections' => array( 'core' ), ), 'chevron-up-small' => array( - 'label' => _x( 'Chevron Up Small', 'icon label', 'gutenberg' ), - 'filePath' => 'library/chevron-up-small.svg', + 'label' => _x( 'Chevron Up Small', 'icon label', 'gutenberg' ), + 'filePath' => 'library/chevron-up-small.svg', + 'collections' => array( 'core' ), ), 'comment' => array( - 'label' => _x( 'Comment', 'icon label', 'gutenberg' ), - 'filePath' => 'library/comment.svg', + 'label' => _x( 'Comment', 'icon label', 'gutenberg' ), + 'filePath' => 'library/comment.svg', + 'collections' => array( 'core', 'core-admin' ), ), 'cover' => array( - 'label' => _x( 'Cover', 'icon label', 'gutenberg' ), - 'filePath' => 'library/cover.svg', + 'label' => _x( 'Cover', 'icon label', 'gutenberg' ), + 'filePath' => 'library/cover.svg', + 'collections' => array( 'core' ), ), 'create' => array( - 'label' => _x( 'Create', 'icon label', 'gutenberg' ), - 'filePath' => 'library/create.svg', + 'label' => _x( 'Create', 'icon label', 'gutenberg' ), + 'filePath' => 'library/create.svg', + 'collections' => array( 'core' ), + ), + 'dashboard' => array( + 'label' => _x( 'Dashboard', 'icon label', 'gutenberg' ), + 'filePath' => 'library/dashboard.svg', + 'collections' => array( 'core-admin' ), ), 'desktop' => array( - 'label' => _x( 'Desktop', 'icon label', 'gutenberg' ), - 'filePath' => 'library/desktop.svg', + 'label' => _x( 'Desktop', 'icon label', 'gutenberg' ), + 'filePath' => 'library/desktop.svg', + 'collections' => array( 'core' ), ), 'download' => array( - 'label' => _x( 'Download', 'icon label', 'gutenberg' ), - 'filePath' => 'library/download.svg', + 'label' => _x( 'Download', 'icon label', 'gutenberg' ), + 'filePath' => 'library/download.svg', + 'collections' => array( 'core' ), ), 'drawer-left' => array( - 'label' => _x( 'Drawer Left', 'icon label', 'gutenberg' ), - 'filePath' => 'library/drawer-left.svg', + 'label' => _x( 'Drawer Left', 'icon label', 'gutenberg' ), + 'filePath' => 'library/drawer-left.svg', + 'collections' => array( 'core' ), ), 'drawer-right' => array( - 'label' => _x( 'Drawer Right', 'icon label', 'gutenberg' ), - 'filePath' => 'library/drawer-right.svg', + 'label' => _x( 'Drawer Right', 'icon label', 'gutenberg' ), + 'filePath' => 'library/drawer-right.svg', + 'collections' => array( 'core' ), ), 'envelope' => array( - 'label' => _x( 'Envelope', 'icon label', 'gutenberg' ), - 'filePath' => 'library/envelope.svg', + 'label' => _x( 'Envelope', 'icon label', 'gutenberg' ), + 'filePath' => 'library/envelope.svg', + 'collections' => array( 'core' ), ), 'error' => array( - 'label' => _x( 'Error', 'icon label', 'gutenberg' ), - 'filePath' => 'library/error.svg', + 'label' => _x( 'Error', 'icon label', 'gutenberg' ), + 'filePath' => 'library/error.svg', + 'collections' => array( 'core' ), ), 'external' => array( - 'label' => _x( 'External', 'icon label', 'gutenberg' ), - 'filePath' => 'library/external.svg', + 'label' => _x( 'External', 'icon label', 'gutenberg' ), + 'filePath' => 'library/external.svg', + 'collections' => array( 'core' ), ), 'file' => array( - 'label' => _x( 'File', 'icon label', 'gutenberg' ), - 'filePath' => 'library/file.svg', + 'label' => _x( 'File', 'icon label', 'gutenberg' ), + 'filePath' => 'library/file.svg', + 'collections' => array( 'core' ), ), 'gallery' => array( - 'label' => _x( 'Gallery', 'icon label', 'gutenberg' ), - 'filePath' => 'library/gallery.svg', + 'label' => _x( 'Gallery', 'icon label', 'gutenberg' ), + 'filePath' => 'library/gallery.svg', + 'collections' => array( 'core' ), ), 'group' => array( - 'label' => _x( 'Group', 'icon label', 'gutenberg' ), - 'filePath' => 'library/group.svg', + 'label' => _x( 'Group', 'icon label', 'gutenberg' ), + 'filePath' => 'library/group.svg', + 'collections' => array( 'core' ), ), 'heading' => array( - 'label' => _x( 'Heading', 'icon label', 'gutenberg' ), - 'filePath' => 'library/heading.svg', + 'label' => _x( 'Heading', 'icon label', 'gutenberg' ), + 'filePath' => 'library/heading.svg', + 'collections' => array( 'core' ), ), 'help' => array( - 'label' => _x( 'Help', 'icon label', 'gutenberg' ), - 'filePath' => 'library/help.svg', + 'label' => _x( 'Help', 'icon label', 'gutenberg' ), + 'filePath' => 'library/help.svg', + 'collections' => array( 'core' ), ), 'home' => array( - 'label' => _x( 'Home', 'icon label', 'gutenberg' ), - 'filePath' => 'library/home.svg', + 'label' => _x( 'Home', 'icon label', 'gutenberg' ), + 'filePath' => 'library/home.svg', + 'collections' => array( 'core', 'core-admin' ), ), 'image' => array( - 'label' => _x( 'Image', 'icon label', 'gutenberg' ), - 'filePath' => 'library/image.svg', + 'label' => _x( 'Image', 'icon label', 'gutenberg' ), + 'filePath' => 'library/image.svg', + 'collections' => array( 'core' ), ), 'info' => array( - 'label' => _x( 'Info', 'icon label', 'gutenberg' ), - 'filePath' => 'library/info.svg', + 'label' => _x( 'Info', 'icon label', 'gutenberg' ), + 'filePath' => 'library/info.svg', + 'collections' => array( 'core' ), ), 'key' => array( - 'label' => _x( 'Key', 'icon label', 'gutenberg' ), - 'filePath' => 'library/key.svg', + 'label' => _x( 'Key', 'icon label', 'gutenberg' ), + 'filePath' => 'library/key.svg', + 'collections' => array( 'core' ), ), 'language' => array( - 'label' => _x( 'Language', 'icon label', 'gutenberg' ), - 'filePath' => 'library/language.svg', + 'label' => _x( 'Language', 'icon label', 'gutenberg' ), + 'filePath' => 'library/language.svg', + 'collections' => array( 'core' ), + ), + 'link' => array( + 'label' => _x( 'Link', 'icon label', 'gutenberg' ), + 'filePath' => 'library/link.svg', + 'collections' => array( 'core-admin' ), ), 'map-marker' => array( - 'label' => _x( 'Map Marker', 'icon label', 'gutenberg' ), - 'filePath' => 'library/map-marker.svg', + 'label' => _x( 'Map Marker', 'icon label', 'gutenberg' ), + 'filePath' => 'library/map-marker.svg', + 'collections' => array( 'core' ), + ), + 'media' => array( + 'label' => _x( 'Media', 'icon label', 'gutenberg' ), + 'filePath' => 'library/media.svg', + 'collections' => array( 'core-admin' ), ), 'menu' => array( - 'label' => _x( 'Menu', 'icon label', 'gutenberg' ), - 'filePath' => 'library/menu.svg', + 'label' => _x( 'Menu', 'icon label', 'gutenberg' ), + 'filePath' => 'library/menu.svg', + 'collections' => array( 'core', 'core-admin' ), ), 'mobile' => array( - 'label' => _x( 'Mobile', 'icon label', 'gutenberg' ), - 'filePath' => 'library/mobile.svg', + 'label' => _x( 'Mobile', 'icon label', 'gutenberg' ), + 'filePath' => 'library/mobile.svg', + 'collections' => array( 'core' ), ), 'more-horizontal' => array( - 'label' => _x( 'More Horizontal', 'icon label', 'gutenberg' ), - 'filePath' => 'library/more-horizontal.svg', + 'label' => _x( 'More Horizontal', 'icon label', 'gutenberg' ), + 'filePath' => 'library/more-horizontal.svg', + 'collections' => array( 'core' ), ), 'more-vertical' => array( - 'label' => _x( 'More Vertical', 'icon label', 'gutenberg' ), - 'filePath' => 'library/more-vertical.svg', + 'label' => _x( 'More Vertical', 'icon label', 'gutenberg' ), + 'filePath' => 'library/more-vertical.svg', + 'collections' => array( 'core' ), ), 'next' => array( - 'label' => _x( 'Next', 'icon label', 'gutenberg' ), - 'filePath' => 'library/next.svg', + 'label' => _x( 'Next', 'icon label', 'gutenberg' ), + 'filePath' => 'library/next.svg', + 'collections' => array( 'core' ), + ), + 'page' => array( + 'label' => _x( 'Page', 'icon label', 'gutenberg' ), + 'filePath' => 'library/page.svg', + 'collections' => array( 'core-admin' ), ), 'paragraph' => array( - 'label' => _x( 'Paragraph', 'icon label', 'gutenberg' ), - 'filePath' => 'library/paragraph.svg', + 'label' => _x( 'Paragraph', 'icon label', 'gutenberg' ), + 'filePath' => 'library/paragraph.svg', + 'collections' => array( 'core' ), ), 'payment' => array( - 'label' => _x( 'Payment', 'icon label', 'gutenberg' ), - 'filePath' => 'library/payment.svg', + 'label' => _x( 'Payment', 'icon label', 'gutenberg' ), + 'filePath' => 'library/payment.svg', + 'collections' => array( 'core' ), ), 'pencil' => array( - 'label' => _x( 'Pencil', 'icon label', 'gutenberg' ), - 'filePath' => 'library/pencil.svg', + 'label' => _x( 'Pencil', 'icon label', 'gutenberg' ), + 'filePath' => 'library/pencil.svg', + 'collections' => array( 'core', 'core-admin' ), ), 'people' => array( - 'label' => _x( 'People', 'icon label', 'gutenberg' ), - 'filePath' => 'library/people.svg', + 'label' => _x( 'People', 'icon label', 'gutenberg' ), + 'filePath' => 'library/people.svg', + 'collections' => array( 'core', 'core-admin' ), + ), + 'pin' => array( + 'label' => _x( 'Pin', 'icon label', 'gutenberg' ), + 'filePath' => 'library/pin.svg', + 'collections' => array( 'core-admin' ), + ), + 'plugins' => array( + 'label' => _x( 'Plugins', 'icon label', 'gutenberg' ), + 'filePath' => 'library/plugins.svg', + 'collections' => array( 'core-admin' ), ), 'plus' => array( - 'label' => _x( 'Plus', 'icon label', 'gutenberg' ), - 'filePath' => 'library/plus.svg', + 'label' => _x( 'Plus', 'icon label', 'gutenberg' ), + 'filePath' => 'library/plus.svg', + 'collections' => array( 'core', 'core-admin' ), ), 'plus-circle' => array( - 'label' => _x( 'Plus Circle', 'icon label', 'gutenberg' ), - 'filePath' => 'library/plus-circle.svg', + 'label' => _x( 'Plus Circle', 'icon label', 'gutenberg' ), + 'filePath' => 'library/plus-circle.svg', + 'collections' => array( 'core' ), ), 'previous' => array( - 'label' => _x( 'Previous', 'icon label', 'gutenberg' ), - 'filePath' => 'library/previous.svg', + 'label' => _x( 'Previous', 'icon label', 'gutenberg' ), + 'filePath' => 'library/previous.svg', + 'collections' => array( 'core' ), ), 'published' => array( - 'label' => _x( 'Published', 'icon label', 'gutenberg' ), - 'filePath' => 'library/published.svg', + 'label' => _x( 'Published', 'icon label', 'gutenberg' ), + 'filePath' => 'library/published.svg', + 'collections' => array( 'core' ), ), 'quote' => array( - 'label' => _x( 'Quote', 'icon label', 'gutenberg' ), - 'filePath' => 'library/quote.svg', + 'label' => _x( 'Quote', 'icon label', 'gutenberg' ), + 'filePath' => 'library/quote.svg', + 'collections' => array( 'core' ), ), 'receipt' => array( - 'label' => _x( 'Receipt', 'icon label', 'gutenberg' ), - 'filePath' => 'library/receipt.svg', + 'label' => _x( 'Receipt', 'icon label', 'gutenberg' ), + 'filePath' => 'library/receipt.svg', + 'collections' => array( 'core' ), ), 'rss' => array( - 'label' => _x( 'RSS', 'icon label', 'gutenberg' ), - 'filePath' => 'library/rss.svg', + 'label' => _x( 'RSS', 'icon label', 'gutenberg' ), + 'filePath' => 'library/rss.svg', + 'collections' => array( 'core' ), ), 'scheduled' => array( - 'label' => _x( 'Scheduled', 'icon label', 'gutenberg' ), - 'filePath' => 'library/scheduled.svg', + 'label' => _x( 'Scheduled', 'icon label', 'gutenberg' ), + 'filePath' => 'library/scheduled.svg', + 'collections' => array( 'core' ), ), 'search' => array( - 'label' => _x( 'Search', 'icon label', 'gutenberg' ), - 'filePath' => 'library/search.svg', + 'label' => _x( 'Search', 'icon label', 'gutenberg' ), + 'filePath' => 'library/search.svg', + 'collections' => array( 'core', 'core-admin' ), ), 'settings' => array( - 'label' => _x( 'Settings', 'icon label', 'gutenberg' ), - 'filePath' => 'library/settings.svg', + 'label' => _x( 'Settings', 'icon label', 'gutenberg' ), + 'filePath' => 'library/settings.svg', + 'collections' => array( 'core', 'core-admin' ), ), 'shadow' => array( - 'label' => _x( 'Shadow', 'icon label', 'gutenberg' ), - 'filePath' => 'library/shadow.svg', + 'label' => _x( 'Shadow', 'icon label', 'gutenberg' ), + 'filePath' => 'library/shadow.svg', + 'collections' => array( 'core' ), ), 'share' => array( - 'label' => _x( 'Share', 'icon label', 'gutenberg' ), - 'filePath' => 'library/share.svg', + 'label' => _x( 'Share', 'icon label', 'gutenberg' ), + 'filePath' => 'library/share.svg', + 'collections' => array( 'core' ), ), 'shield' => array( - 'label' => _x( 'Shield', 'icon label', 'gutenberg' ), - 'filePath' => 'library/shield.svg', + 'label' => _x( 'Shield', 'icon label', 'gutenberg' ), + 'filePath' => 'library/shield.svg', + 'collections' => array( 'core' ), ), 'shuffle' => array( - 'label' => _x( 'Shuffle', 'icon label', 'gutenberg' ), - 'filePath' => 'library/shuffle.svg', + 'label' => _x( 'Shuffle', 'icon label', 'gutenberg' ), + 'filePath' => 'library/shuffle.svg', + 'collections' => array( 'core' ), + ), + 'sites' => array( + 'label' => _x( 'Sites', 'icon label', 'gutenberg' ), + 'filePath' => 'library/sites.svg', + 'collections' => array( 'core-admin' ), ), 'star-empty' => array( - 'label' => _x( 'Star Empty', 'icon label', 'gutenberg' ), - 'filePath' => 'library/star-empty.svg', + 'label' => _x( 'Star Empty', 'icon label', 'gutenberg' ), + 'filePath' => 'library/star-empty.svg', + 'collections' => array( 'core' ), ), 'star-filled' => array( - 'label' => _x( 'Star Filled', 'icon label', 'gutenberg' ), - 'filePath' => 'library/star-filled.svg', + 'label' => _x( 'Star Filled', 'icon label', 'gutenberg' ), + 'filePath' => 'library/star-filled.svg', + 'collections' => array( 'core' ), ), 'star-half' => array( - 'label' => _x( 'Star Half', 'icon label', 'gutenberg' ), - 'filePath' => 'library/star-half.svg', + 'label' => _x( 'Star Half', 'icon label', 'gutenberg' ), + 'filePath' => 'library/star-half.svg', + 'collections' => array( 'core' ), ), 'store' => array( - 'label' => _x( 'Store', 'icon label', 'gutenberg' ), - 'filePath' => 'library/store.svg', + 'label' => _x( 'Store', 'icon label', 'gutenberg' ), + 'filePath' => 'library/store.svg', + 'collections' => array( 'core' ), ), 'styles' => array( - 'label' => _x( 'Styles', 'icon label', 'gutenberg' ), - 'filePath' => 'library/styles.svg', + 'label' => _x( 'Styles', 'icon label', 'gutenberg' ), + 'filePath' => 'library/styles.svg', + 'collections' => array( 'core' ), ), 'symbol' => array( - 'label' => _x( 'Symbol', 'icon label', 'gutenberg' ), - 'filePath' => 'library/symbol.svg', + 'label' => _x( 'Symbol', 'icon label', 'gutenberg' ), + 'filePath' => 'library/symbol.svg', + 'collections' => array( 'core' ), ), 'symbol-filled' => array( - 'label' => _x( 'Symbol Filled', 'icon label', 'gutenberg' ), - 'filePath' => 'library/symbol-filled.svg', + 'label' => _x( 'Symbol Filled', 'icon label', 'gutenberg' ), + 'filePath' => 'library/symbol-filled.svg', + 'collections' => array( 'core' ), ), 'table' => array( - 'label' => _x( 'Table', 'icon label', 'gutenberg' ), - 'filePath' => 'library/table.svg', + 'label' => _x( 'Table', 'icon label', 'gutenberg' ), + 'filePath' => 'library/table.svg', + 'collections' => array( 'core' ), ), 'tablet' => array( - 'label' => _x( 'Tablet', 'icon label', 'gutenberg' ), - 'filePath' => 'library/tablet.svg', + 'label' => _x( 'Tablet', 'icon label', 'gutenberg' ), + 'filePath' => 'library/tablet.svg', + 'collections' => array( 'core' ), ), 'tag' => array( - 'label' => _x( 'Tag', 'icon label', 'gutenberg' ), - 'filePath' => 'library/tag.svg', + 'label' => _x( 'Tag', 'icon label', 'gutenberg' ), + 'filePath' => 'library/tag.svg', + 'collections' => array( 'core' ), ), 'tip' => array( - 'label' => _x( 'Tip', 'icon label', 'gutenberg' ), - 'filePath' => 'library/tip.svg', + 'label' => _x( 'Tip', 'icon label', 'gutenberg' ), + 'filePath' => 'library/tip.svg', + 'collections' => array( 'core' ), + ), + 'tool' => array( + 'label' => _x( 'Tool', 'icon label', 'gutenberg' ), + 'filePath' => 'library/tool.svg', + 'collections' => array( 'core-admin' ), + ), + 'update' => array( + 'label' => _x( 'Update', 'icon label', 'gutenberg' ), + 'filePath' => 'library/update.svg', + 'collections' => array( 'core-admin' ), ), 'upload' => array( - 'label' => _x( 'Upload', 'icon label', 'gutenberg' ), - 'filePath' => 'library/upload.svg', + 'label' => _x( 'Upload', 'icon label', 'gutenberg' ), + 'filePath' => 'library/upload.svg', + 'collections' => array( 'core' ), ), 'verse' => array( - 'label' => _x( 'Verse', 'icon label', 'gutenberg' ), - 'filePath' => 'library/verse.svg', + 'label' => _x( 'Verse', 'icon label', 'gutenberg' ), + 'filePath' => 'library/verse.svg', + 'collections' => array( 'core' ), + ), + 'wordpress' => array( + 'label' => _x( 'WordPress', 'icon label', 'gutenberg' ), + 'filePath' => 'library/wordpress.svg', + 'collections' => array( 'core-admin' ), ), ); diff --git a/phpunit/blocks/render-block-icon-test.php b/phpunit/blocks/render-block-icon-test.php index 77bf89980d844f..8992ae312af35b 100644 --- a/phpunit/blocks/render-block-icon-test.php +++ b/phpunit/blocks/render-block-icon-test.php @@ -28,12 +28,20 @@ public function set_up() { 'attrs' => array(), ); - if ( ! WP_Icon_Collections_Registry::get_instance()->is_registered( 'core' ) ) { - gutenberg_register_default_icon_collections(); - } - if ( empty( WP_Icons_Registry_Gutenberg::get_instance()->get_registered_icons() ) ) { - gutenberg_register_default_icons(); + /* + * Other suites reset the `WP_Icons_Registry` singleton, wiping the collections and + * icons that `init` only registers once. Replay the registration so order-dependent + * tests pass. `gutenberg_register_default_icon_collections()` registers every default + * collection at once, so drop whatever survived rather than topping up. + */ + $collections_registry = WP_Icon_Collections_Registry::get_instance(); + foreach ( array( 'core', 'core-admin' ) as $collection_slug ) { + if ( $collections_registry->is_registered( $collection_slug ) ) { + $collections_registry->unregister( $collection_slug ); + } } + gutenberg_register_default_icon_collections(); + gutenberg_register_default_icons(); } public function tear_down() { diff --git a/phpunit/class-wp-icon-test.php b/phpunit/class-wp-icon-test.php index d3ab2a64ec31fb..495d3712cc2855 100644 --- a/phpunit/class-wp-icon-test.php +++ b/phpunit/class-wp-icon-test.php @@ -11,15 +11,19 @@ public function set_up() { parent::set_up(); /* - * Other suites reset the `WP_Icons_Registry` singleton, wiping the core icons that - * `init` only registers once. Re-register them when empty so order-dependent tests pass. + * Other suites reset the `WP_Icons_Registry` singleton, wiping the collections and + * icons that `init` only registers once. Replay the registration so order-dependent + * tests pass. `gutenberg_register_default_icon_collections()` registers every default + * collection at once, so drop whatever survived rather than topping up. */ - if ( ! WP_Icon_Collections_Registry::get_instance()->is_registered( 'core' ) ) { - gutenberg_register_default_icon_collections(); - } - if ( empty( WP_Icons_Registry_Gutenberg::get_instance()->get_registered_icons() ) ) { - gutenberg_register_default_icons(); + $collections_registry = WP_Icon_Collections_Registry::get_instance(); + foreach ( array( 'core', 'core-admin' ) as $collection_slug ) { + if ( $collections_registry->is_registered( $collection_slug ) ) { + $collections_registry->unregister( $collection_slug ); + } } + gutenberg_register_default_icon_collections(); + gutenberg_register_default_icons(); } public function test_wp_get_icon_returns_svg_for_known_icon() { @@ -99,4 +103,21 @@ public function test_wp_get_icon_escapes_attributes() { $output = wp_get_icon( 'core/plus', array( 'class' => '">' ) ); $this->assertStringNotContainsString( '