Astra_Update_Header_Builder::configure()
Configure the ability.
Description
Return
(void)
Source
File: inc/abilities/customizer/header/class-astra-update-header-builder.php
public function configure() {
$this->id = 'astra/update-header-builder';
$this->category = 'astra';
$this->label = __( 'Update Astra Header Builder Settings', 'astra' );
$this->description = __( 'Updates the Astra theme header builder configuration for desktop and mobile layouts. Allows positioning components like buttons, HTML blocks, menus, widgets, social icons, and search in popup (mobile drawer), above header, primary header, and below header sections with specific zone placements.', 'astra' );
$this->meta = array(
'tool_type' => 'write',
'constraints' => array(
'dependencies' => array(
array(
'tool' => 'astra/get-header-builder',
'description_hint' => 'Get current header layout and available_components before updating',
),
),
'usage_hints' => array(
'CRITICAL_WORKFLOW' => 'ALWAYS call astra/get-header-builder FIRST before updating. This tool returns available_components (exact IDs to use) and current layout. SMART APPEND: When adding a single new component to a zone, it automatically appends to existing components. When sending multiple components or removing, it replaces. Only specify zones you are changing.',
'component_ids' => 'EXACT component IDs (case-sensitive, use exactly as shown): logo, menu-1, menu-2, mobile-menu, mobile-trigger, button-1, button-2, button-3, html-1, html-2, html-3, widget-1, widget-2, widget-3, social-icons-1 (NOT social-1!), social-icons-2, search, woo-cart, edd-cart, account, language-switcher. NEVER use "social-1" or "primary-menu" - use "social-icons-1" and "menu-1".',
'desktop_structure' => 'Desktop has 4 sections: popup (off-canvas), above (top row), primary (main row), below (bottom row). Each visible row has 5 zones: section_left, section_left_center, section_center, section_right_center, section_right. Popup has popup_content zone. Zone names: above_left, above_left_center, above_center, above_right_center, above_right, primary_left, primary_left_center, primary_center, primary_right_center, primary_right, below_left, below_left_center, below_center, below_right_center, below_right, popup_content.',
'mobile_structure' => 'Mobile has 4 sections: popup (drawer menu), above, primary, below. Each visible row has 3 zones: section_left, section_center, section_right. Popup has popup_content. Zone names: above_left, above_center, above_right, primary_left, primary_center, primary_right, below_left, below_center, below_right, popup_content. Typical mobile: logo in primary_left, mobile-trigger in primary_right, mobile-menu in popup_content.',
'moving_components' => 'To MOVE a component: Send the single component ID to the new zone (auto-removes from old location). Example: To move menu-1 to above_center: {"desktop": {"above": {"above_center": ["menu-1"]}}}. The component is automatically added to the new zone while preserving other existing components in that zone.',
'adding_components' => 'To ADD a single component: Simply send the component ID in an array to the target zone. Example: To add search to primary_right: {"desktop": {"primary": {"primary_right": ["search"]}}}. SMART BEHAVIOR: The search component will be automatically APPENDED to existing components in primary_right (e.g., if primary_right has ["menu-1"], result will be ["menu-1", "search"]). No need to include existing components when adding a single new one.',
'removing_components' => 'To REMOVE a specific component: Send zone with only the components you want to KEEP (exclude the one to remove). Example: To remove search from primary_right (currently has ["logo", "menu-1", "search"]): {"desktop": {"primary": {"primary_right": ["logo", "menu-1"]}}}. To clear entire zone: send empty array []. Note: Sending a single existing component will keep only that one (removes others).',
'multiple_operations' => 'To ADD multiple components at once OR rearrange: Send the complete array with all components in desired order. Example: To add both search and button-1 to primary_right (currently has ["menu-1"]): {"desktop": {"primary": {"primary_right": ["menu-1", "search", "button-1"]}}}. Order in array determines display order.',
'zone_arrays' => 'Smart zone behavior: Single NEW component ["search"] = APPEND to existing. Single EXISTING component ["menu-1"] = KEEP only this (remove others). Multiple components ["logo", "menu-1", "search"] = REPLACE with exact list. Empty array [] = CLEAR zone. This smart behavior makes it easy to add components without knowing the current layout.',
'popup_usage' => 'Desktop popup: Typically {"popup": {"popup_content": ["mobile-menu"]}} for responsive behavior. Mobile popup: {"popup": {"popup_content": ["mobile-menu", "social-icons-1", "button-1"]}} - this is the hamburger menu drawer content. The mobile-trigger component (usually in primary_right) opens the popup. Components in popup_content display vertically in the drawer.',
'common_mistakes' => 'AVOID: 1) Using "social-1" instead of "social-icons-1" (wrong ID), 2) Using zone names incorrectly (e.g., "primary-left" instead of "primary_left"), 3) Providing string instead of array (use ["menu-1"] not "menu-1"), 4) Updating mobile_popup separately (deprecated - use mobile.popup instead). Good news: You no longer need to include existing components when adding a single new component - it auto-appends!',
'responsive_design' => 'Desktop and mobile are INDEPENDENT. A component in desktop primary_right does NOT automatically appear in mobile. Must explicitly configure both desktop and mobile layouts. Typical pattern: Desktop has full menu in primary_right, mobile has mobile-trigger in primary_right with mobile-menu in popup_content. Configure both in same update or separately.',
),
),
);
}
Expand full source code Collapse full source code View on Trac