Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions schemas/ui-options-page.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,30 @@
},
"menu_icon": {
"oneOf": [
{
"type": "string",
"description": "Icon as string: Dashicon name (e.g. 'dashicons-admin-generic') or full URL to image file"
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [ "dashicons", "url", "media_library" ],
"description": "Icon source type: 'dashicons' for WordPress dashicons, 'url' for custom image URL, 'media_library' for media library attachment"
"description": "Icon source type: 'dashicons' for WordPress dashicons, 'url' for custom image URL, 'media_library' for media library attachment ID"
},
"value": {
"type": [ "string", "integer" ],
"description": "The icon value: dashicon class name, image URL, or media library attachment ID"
"description": "The icon value: dashicon class name (e.g. 'dashicons-admin-generic'), image URL, or media library attachment ID"
}
},
"required": [ "type", "value" ],
"additionalProperties": false,
"description": "[SCF] SCF icon object format: {\"type\": \"dashicons\", \"value\": \"dashicons-admin-generic\"}"
"description": "[SCF] Object with type and value properties specifying the icon source and identifier."
},
{
"type": "array",
"maxItems": 0,
"description": "Empty array representing unset/default state (no icon configured)."
}
],
"description": "The menu icon. Can be a string (URL or dashicon name) or SCF object format with type and value properties."
"description": "The menu icon displayed in the admin menu. Accepts object format with type/value properties, or empty array when no icon is configured."
},
"position": {
"type": [ "integer", "string", "null" ],
Expand Down
18 changes: 9 additions & 9 deletions tests/php/schemas/UIOptionsPageSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,6 @@ public function validEntitiesProvider(): array {
),
'Parent page with menu_icon object should be valid',
),
'menu_icon as string' => array(
array(
'key' => 'ui_options_page_settings',
'title' => 'Settings',
'menu_slug' => 'settings',
'menu_icon' => 'dashicons-admin-generic',
),
'Options page with menu_icon as string should be valid',
),
'menu_icon with url type' => array(
array(
'key' => 'ui_options_page_settings',
Expand All @@ -153,6 +144,15 @@ public function validEntitiesProvider(): array {
),
'Options page with menu_icon media_library type should be valid',
),
'menu_icon as empty array' => array(
array(
'key' => 'ui_options_page_settings',
'title' => 'Settings',
'menu_slug' => 'settings',
'menu_icon' => array(),
),
'Options page with empty menu_icon array (default state when no icon configured) should be valid',
),
'child page with parent_slug' => array(
array(
'key' => 'ui_options_page_child',
Expand Down
Loading