…, 'placeholder' => …]) * * A theme that answers it owns the form completely, including enqueuing whatever script it needs. * * With no answerer — a site running some other theme — this falls back to core's `get_search_form()`. * That is deliberately different from the other moved shortcodes, which come out unstyled on a foreign * theme: a search box that does not search is useless, while an unstyled one still works. */ final class Search { public static function boot(): void { add_shortcode('aumframe_search', [self::class, 'render']); } public static function render($atts = []): string { $a = shortcode_atts([ 'class' => '', 'placeholder' => '', ], is_array($atts) ? $atts : [], 'aumframe_search'); $class = sanitize_text_field((string) $a['class']); $placeholder = sanitize_text_field((string) $a['placeholder']); $html = Ask::html('aumframe_search', ['class' => $class, 'placeholder' => $placeholder]); if (trim($html) !== '') { return $html; } /* * Nobody answered. Core's form rather than nothing: `get_search_form()` respects a theme's * `searchform.php` if it has one, and otherwise emits a plain working form. The `$class` is put on a * wrapper because core's markup is not ours to change. */ $core = (string) get_search_form(['echo' => false]); if ($class === '') { return $core; } return '
' . $core . '
'; } }