Generate ids for form locations

This commit is contained in:
Cooper Dalrymple
2026-08-03 17:14:17 -05:00
parent 2b10a82fdd
commit e5da11e5f2
4 changed files with 36 additions and 6 deletions
+16 -2
View File
@@ -47,8 +47,17 @@ abstract class Location {
abstract public function activate():void;
protected function get_widget_id(): string {
return sprintf(
'cap-%s',
$this->name
);
}
public function render():void {
Widget::render();
Widget::render([
'id' => $this->get_widget_id(),
]);
}
public function process(WP_Error|null $errors = null):void {
@@ -78,7 +87,12 @@ abstract class Location {
public function footer():void {
if (!Settings::is_widget_floating()) return;
$html = ob_get_clean();
$html = Widget::set_button_floating($html);
$html = Widget::set_button_floating(
$html,
[
'id' => $this->get_widget_id(),
]
);
echo $html;
}