subID ?? get_option('aacb_siteID');
// Extract current values
$color = $site_options->triggerBtnBg ?? '#2b446d';
// Convert RGB color to hex if needed (database might have rgb(r,g,b) format)
$color = trim($color);
if (strpos($color, 'rgb') !== false) {
preg_match('/rgb\((\d+),\s*(\d+),\s*(\d+)\)/', $color, $matches);
if (count($matches) === 4) {
$color = sprintf("#%02x%02x%02x", $matches[1], $matches[2], $matches[3]);
} else {
$color = '#2b446d'; // Fallback
}
}
$position = $site_options->buttonPosition ?? 'bottom-right';
$size = $site_options->triggerBtnSize ?? '55';
$icon = $site_options->triggerSVG ?? 'Default';
$shape = $site_options->triggerBtnRadius ?? '50';
$white_label = $site_options->isWhitelabel ?? false;
// Headless mode: hide visible widget bubble while AllAccessible agents continue
// running remediation in the background. Prefer the backend-stored flag
// (from site_options) so multi-device admins see consistent state; fall back
// to local aacb_options for sites that haven't synced yet.
$aacb_local_opts = get_option('aacb_options', array());
$headless_mode = isset($site_options->headlessMode)
? (bool) $site_options->headlessMode
: !empty($aacb_local_opts['headless_mode']);
// Hide the trigger button on viewports under 768px. /validate returns the
// dashboard's nested appearance.trigger.hideOnMobile alongside the flat
// plugin key; nested wins (matches the server-side config merge order).
$hide_mobile = !empty($site_options->appearance->trigger->hideOnMobile ?? $site_options->triggerHideOnMobile ?? false);
// Trigger icon SVGs (plugin-authored markup, same set as the v1.3.8 widget).
// Single source for both the PHP tile glyphs and the JS preview object.
$svg_icons = array(
'Default' => '',
'Alt' => '',
'Alt2' => '',
'Adjust' => '',
'Braille' => '',
'Blind' => '',
'Eye' => '',
'Cogs' => '',
'Globe' => '',
'Heart' => '',
'Chair2' => '',
'Chair3' => '',
'Access' => '',
'Cane' => '',
);
// Tile order/labels match the former