Skip to content
Snippets Groups Projects
Commit 81930e1d authored by Igor Biki's avatar Igor Biki
Browse files

Merge branch...

Merge branch 'feature/ISTWCMS-4812-l26yan-Remove-revert-to-defaults-option-for-layout-builder' into '8.x-1.x'

ISTWCMS-4812 Remove 'revert to defaults' option for layout builder

See merge request !93
parents 04689767 e6c1384b
No related branches found
No related tags found
1 merge request!93ISTWCMS-4812 Remove 'revert to defaults' option for layout builder
<?php
namespace Drupal\uw_cfg_common\EventSubscriber;
use Drupal\core_event_dispatcher\Event\Form\FormAlterEvent;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* UW custom block fact and figures event subscriber.
*/
class UwLayoutBuilderEventSubscriber implements EventSubscriberInterface {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
HookEventDispatcherInterface::FORM_ALTER => 'alterForm',
];
}
/**
* Alter form.
*
* @param \Drupal\core_event_dispatcher\Event\Form\FormAlterEvent $event
* The event.
*/
public function alterForm(FormAlterEvent $event): void {
$form = &$event->getForm();
if (isset($form['actions']['revert']) && substr($form['#form_id'], -20) == '_layout_builder_form') {
unset($form['actions']['revert']);
}
}
}
...@@ -16,3 +16,7 @@ services: ...@@ -16,3 +16,7 @@ services:
uw_cfg_common.uw_analytics: uw_cfg_common.uw_analytics:
class: \Drupal\uw_cfg_common\Service\UWAnalytics class: \Drupal\uw_cfg_common\Service\UWAnalytics
arguments: ['@router.admin_context', '@current_route_match'] arguments: ['@router.admin_context', '@current_route_match']
uw_cfg_common.event_subscriber:
class: '\Drupal\uw_cfg_common\EventSubscriber\UwLayoutBuilderEventSubscriber'
tags:
- { name: 'event_subscriber' }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment