devel_wizard-2.x-dev/templates/spell/event_subscriber/class.php.twig

templates/spell/event_subscriber/class.php.twig
{%
  include '@devel_wizard/php/devel_wizard.php.file.header.php.twig'
  with {
    'namespace': eventSubscriber.classNamespace,
  }
%}

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class {{ eventSubscriber.className }} implements EventSubscriberInterface {

  public function __construct(
    protected EntityTypeManagerInterface $entityTypeManager,
  ) {
  }

  /**
   * {@inheritdoc}
   *
   * @phpstan-return array{{ '<' }}string, mixed{{ '>' }}
   */
  public static function getSubscribedEvents(): array {
    return [
      \Drupal\Core\Config\ConfigEvents::SAVE => [
        ['onConfigSave'],
      ],
    ];
  }

  public function onConfigSave(\Drupal\Core\Config\ConfigCrudEvent $event): void {
    // @todo Do something.
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc