@php /** * A button's destination: a dropdown of this site's own pages, with "custom link" as the deliberate * way out. * * A LINK field used to be a plain text box, so every button's destination was either hardcoded in a * template or typed by hand — which is how a storefront ends up with buttons pointing at pages that * no longer exist, and why nothing stopped one pointing off-site by accident. The stored value is * unchanged: still a plain path or URL, so every link saved before this existed keeps working. * * @var string $name posted input name * @var string $value current destination * @var string $id id for the select * @var string $label accessible name */ $value = trim((string) ($value ?? '')); $id = (string) ($id ?? ('qm-link-' . substr(md5($name), 0, 8))); $label = (string) ($label ?? t_raw('admin.pc.f_btn_link')); $options = \App\Services\FieldOptions::links(); // Anything not in the list is a custom destination — an external address, or an anchor such as the // Partner page's "#pricing". The box is shown already filled so it reads as the current answer. $isCustom = $value !== '' && !isset($options[$value]); @endphp
@php // The one input that posts. The select writes into it, so the stored value stays a plain // path and nothing downstream has to learn about the picker. @endphp