Generate ids for form locations
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user