add options in setting events
This commit is contained in:
parent
00b92b30ba
commit
e2f1d04ce7
|
@ -26,11 +26,13 @@ class NavigationSettingAdminController extends AdminController
|
|||
Request $request
|
||||
): Response {
|
||||
$builder = $this->createFormBuilder($entity);
|
||||
|
||||
$eventDispatcher->dispatch(new NavigationSettingEvent([
|
||||
$event = new NavigationSettingEvent([
|
||||
'builder' => $builder,
|
||||
'entity' => $entity,
|
||||
]), NavigationSettingEvent::FORM_INIT_EVENT);
|
||||
'options' => [],
|
||||
]);
|
||||
|
||||
$eventDispatcher->dispatch($event, NavigationSettingEvent::FORM_INIT_EVENT);
|
||||
|
||||
$form = $builder->getForm();
|
||||
|
||||
|
@ -52,6 +54,7 @@ class NavigationSettingAdminController extends AdminController
|
|||
return $this->render('@Core/setting/navigation_setting_admin/edit.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'entity' => $entity,
|
||||
'options' => $event->getData()['options'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,11 +48,13 @@ class SettingAdminController extends AdminController
|
|||
Request $request
|
||||
): Response {
|
||||
$builder = $this->createFormBuilder($entity);
|
||||
|
||||
$eventDispatcher->dispatch(new SettingEvent([
|
||||
$event = new SettingEvent([
|
||||
'builder' => $builder,
|
||||
'entity' => $entity,
|
||||
]), SettingEvent::FORM_INIT_EVENT);
|
||||
'options' => [],
|
||||
]);
|
||||
|
||||
$eventDispatcher->dispatch($event, SettingEvent::FORM_INIT_EVENT);
|
||||
|
||||
$form = $builder->getForm();
|
||||
|
||||
|
@ -72,6 +74,7 @@ class SettingAdminController extends AdminController
|
|||
return $this->render('@Core/setting/setting_admin/edit.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'entity' => $entity,
|
||||
'options' => $event->getData()['options'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,4 +25,11 @@ class NavigationSettingEvent extends Event
|
|||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setOption(string $key, $value): self
|
||||
{
|
||||
$this->data['options'][$key] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,11 @@ class SettingEvent extends Event
|
|||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function setOption(string $key, $value): self
|
||||
{
|
||||
$this->data['options'][$key] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="modal-dialog">
|
||||
<div class="modal-dialog {% if options['view']|default('') == 'large' %}modal-dialog-large{% endif %}">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{ entity.section|trans }}</h5>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="modal-dialog">
|
||||
<div class="modal-dialog {% if options['view']|default('') == 'large' %}modal-dialog-large{% endif %}">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{ entity.section|trans }}</h5>
|
||||
|
|
Loading…
Reference in New Issue