|
Calendar |
7.34 |
Calendar |
CalendarモジュールとGoogleカレンダーを同期するには |
|
ユーザ |
7.34 |
ip_ranges |
ログインアタック対策は? |
|
JavaScript |
7.34 |
PHP |
PHPからJavaScriptに変数値を渡したい |
|
コンテンツの作成 |
7.31 |
CKEditor |
CKEditorの新規生成ダイアログ内の初期値の変更 |
|
サイトの構築 |
7.31 |
Views |
ブロックViewsの絞り込みが表示されない |
|
言語 |
7.28 |
vim |
vimで全角が化けてしまう |
|
GoogleMaps |
7.28 |
Javascript |
IE9でGoogle Map APIを利用した住所情報所得がうまくゆかない |
|
アップデート |
7.28 |
Views |
Pagerが表示されなくなった |
|
アップデート |
7.28 |
DisableMessages |
モジュールのアップデートガイダンスを非表示にしたい |
|
ユーザの管理 |
7.27 |
PHP |
新規ユーザーの追加ができない |
|
サイトの構築 |
7.27 |
Context block |
ページ別、カテゴリ別等でブロックの表示有無を簡単にするには |
|
チューニング |
7.26 |
PHP |
DrupalはNginxで動く? |
|
排他 |
7.26 |
lock |
Viewsモジュールの設定ページのような排他機能 |
|
コンテンツの作成 |
7.26 |
PHP |
ノード内の一部(フィールド)を変更する |
|
テーマ |
7.23 |
hook |
ページや状況によってテーマを切り替える |
|
ユーザ |
7.23 |
User |
長い投稿者名の表示が切れる |
|
サイトの環境設定 |
7.23 |
Image Style |
画像スタイルの使い方(Crop) |
|
サイトの構築 |
7.23 |
Conditional fields |
ノード編集フォームを動的にしたい |
|
コンテンツの作成 |
7.23 |
maxlength |
テキストフィールドの最大長のチェック&カウントダウン |
|
ユーザ |
7.23 |
PHP |
user_load_multiple()の復帰値 |
コメント
カスタムモジュールで対応
パーマリンク Submitted by actbrain on 2018/01/12 11:27.
カスタムモジュールで対応
module_name.info.yml
module_name.services.yml
services: module_name_event_subscriber: class: Drupal\module_name\EventSubscriber\Module_nameSubscriber tags: - {name: event_subscriber}src/EventSubscriber/Module_nameSubscriber.php
<?php namespace Drupal\min_init\EventSubscriber; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class Min_initSubscriber implements EventSubscriberInterface { public function checkForRedirection(GetResponseEvent $event) { $request_uri = $_SERVER['REQUEST_URI']; \Drupal::logger('min_init')->notice($request_uri); if (preg_match('!^(/node/[0-9]+/)(edit|clone/prepopulate).*?destination=node/[0-9]+$!', $request_uri, $m)) { $path = \Drupal\Core\Url::fromUserInput($m[1] . $m[2]); $response = new RedirectResponse($path->toString()); $response->send(); } } /** * {@inheritdoc} */ public static function getSubscribedEvents() { $events[KernelEvents::REQUEST][] = array('checkForRedirection'); return $events; } }ページ