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