ワンクリックで
drupal-events
Drupal event subscribers — Symfony events (PSR-14), KernelEvents, services.yml tags, and hooks vs events decision guide.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Drupal event subscribers — Symfony events (PSR-14), KernelEvents, services.yml tags, and hooks vs events decision guide.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
HTMX in Drupal 11.3+ core — the Htmx PHP fluent builder, dynamic forms with swapOob, partial routes with _htmx_route, response headers, and Drupal.behaviors integration. Use when building interactive UI without full-page reloads using Drupal's native HTMX support.
DDEV local development expertise. Use when working with DDEV projects, containers, configuration, or troubleshooting DDEV environments.
Custom Docker Compose local development patterns. Use when working with Docker-based local environments, container configuration, or troubleshooting Docker setups.
Drupal access control — permissions.yml, access callbacks, AccessResult, custom access checkers, and entity access.
Drupal Cache API — cache tags, contexts, max-age, cache bins, invalidation, and adding cache metadata to render arrays.
Drupal Composer management — requiring modules, updates, patches via composer-patches, and version constraints.
| name | drupal-events |
| description | Drupal event subscribers — Symfony events (PSR-14), KernelEvents, services.yml tags, and hooks vs events decision guide. |
// src/EventSubscriber/MyEventSubscriber.php
namespace Drupal\my_module\EventSubscriber;
use Drupal\Core\Session\AccountProxyInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
final class MyEventSubscriber implements EventSubscriberInterface {
public function __construct(
private readonly AccountProxyInterface $currentUser,
) {}
public static function getSubscribedEvents(): array {
return [
// Note: Higher priority runs earlier. Default is 0.
KernelEvents::REQUEST => ['onRequest', 100],
];
}
public function onRequest(RequestEvent $event): void {
if (!$event->isMainRequest()) {
return;
}
if (!$this->currentUser->isAuthenticated()) {
return;
}
// Example: log or modify behavior for authenticated users.
}
}
services:
my_module.my_event_subscriber:
class: Drupal\my_module\EventSubscriber\MyEventSubscriber
arguments: ['@current_user']
tags:
- { name: event_subscriber }
| Event | Constant | When |
|---|---|---|
| Request | KernelEvents::REQUEST | Every request |
| Response | KernelEvents::RESPONSE | Before response sent |
| Terminate | KernelEvents::TERMINATE | After response sent |
| Exception | KernelEvents::EXCEPTION | On uncaught exception |
drush generate event-subscriber --answers='{
"module": "my_module",
"class": "MyEventSubscriber",
"event": "kernel.request"
}'