@php /** * THE icon dropdown. There is one, and this is it. * * Three grew separately — the content editor's, Admin -> Footer's social picker, and Admin -> * Navigation's — with three different sets of chrome and three different lists. Footer and * Navigation had no search at all, so a hundred cells were scrolled by eye, and the brand marks * existed only in Footer, so no other field could ever hold one. They are one component now: * add a glyph here and every picker in the product has it. * * Every picker holds the same three parts, in the same order: * * 1. No icon first, drawn as fa-ban. It used to be drawn as fa-circle, which is itself a * real choosable glyph further down the same grid — two identical dots, one * meaning "none" and one meaning "a circle". fa-ban is the only cell that reads * as an absence. Pickers whose field must hold something pass allowNone false. * 2. Social the brand marks, inline SVG in their own colours. * 3. Icons the glyph library, FieldOptions::ICONS. * * Stored values keep the form they already had — 'fa-bolt', 'facebook', and Footer's older * 'icon:globe' — so nothing saved before this existed changes meaning. * * @var string $name posted input name * @var string $value current value, '' for none * @var string $id id for the trigger button * @var string $label accessible name for the trigger * @var bool $allowNone offer the "no icon" cell (default true) */ $value = (string) ($value ?? ''); $id = (string) ($id ?? ('qm-icon-' . substr(md5($name), 0, 8))); $label = (string) ($label ?? t_raw('admin.pc.f_icon')); $allowNone = !isset($allowNone) || $allowNone; $none = t_raw('admin.navigation.icon_none'); $social = \App\Services\SocialNetwork::class; /* The trigger is built here rather than through icon_html(), because it carries the data-pc-icon-current marker the script replaces on every pick — and it must be produced in exactly the shape that script writes back, or the first pick would change the markup. */ $trigger = $value === '' ? '' : (str_starts_with($value, 'fa-') ? '' : '' . $social::icon($value) . ''); @endphp