| 1 |
<?php |
| 2 |
/** |
| 3 |
* Widget-owned icons. |
| 4 |
* |
| 5 |
* Icons the widgets reference declaratively but that are not public in |
| 6 |
* the `core` collection, registered under a collection the widgets own. |
| 7 |
* |
| 8 |
* @package gutenberg |
| 9 |
*/ |
| 10 |
|
| 11 |
/** |
| 12 |
* Registers the dashboard widgets icon collection and its icons. |
| 13 |
* |
| 14 |
* Content is sourced from the `@wordpress/icons` library files. |
| 15 |
*/ |
| 16 |
function gutenberg_register_dashboard_widget_icons() { |
| 17 |
if ( ! function_exists( 'wp_register_icon_collection' ) ) { |
| 18 |
return; |
| 19 |
} |
| 20 |
|
| 21 |
// Register widget-dashboard icon collection |
| 22 |
wp_register_icon_collection( |
| 23 |
'dashboard-widgets', |
| 24 |
array( |
| 25 |
'label' => __( 'Dashboard Widgets', 'gutenberg' ), |
| 26 |
'description' => __( 'Icons owned by the dashboard widgets.', 'gutenberg' ), |
| 27 |
) |
| 28 |
); |
| 29 |
|
| 30 |
// Register temporary draft icon since it's still a core private icon |
| 31 |
wp_register_icon( |
| 32 |
'dashboard-widgets/drafts', |
| 33 |
array( |
| 34 |
'label' => __( 'Drafts', 'gutenberg' ), |
| 35 |
'file_path' => gutenberg_dir_path() . 'packages/icons/src/library/drafts.svg', |
| 36 |
) |
| 37 |
); |
| 38 |
|
| 39 |
// Register temporary WordPress icon since it's still a core private icon |
| 40 |
wp_register_icon( |
| 41 |
'dashboard-widgets/wordpress', |
| 42 |
array( |
| 43 |
'label' => __( 'WordPress', 'gutenberg' ), |
| 44 |
'file_path' => gutenberg_dir_path() . 'packages/icons/src/library/wordpress.svg', |
| 45 |
) |
| 46 |
); |
| 47 |
|
| 48 |
// Register temporary site logo icon since it's still a core private icon |
| 49 |
wp_register_icon( |
| 50 |
'dashboard-widgets/site-logo', |
| 51 |
array( |
| 52 |
'label' => __( 'Site Logo', 'gutenberg' ), |
| 53 |
'file_path' => gutenberg_dir_path() . 'packages/icons/src/library/site-logo.svg', |
| 54 |
) |
| 55 |
); |
| 56 |
|
| 57 |
// Register temporary seen icon since it's still a core private icon |
| 58 |
wp_register_icon( |
| 59 |
'dashboard-widgets/seen', |
| 60 |
array( |
| 61 |
'label' => __( 'Seen', 'gutenberg' ), |
| 62 |
'file_path' => gutenberg_dir_path() . 'packages/icons/src/library/seen.svg', |
| 63 |
) |
| 64 |
); |
| 65 |
} |
| 66 |
add_action( 'init', 'gutenberg_register_dashboard_widget_icons' ); |
| 67 |
|