app/Plugin/NZCustomPlugin/Event/NZCustomPluginEvent.php line 23

Open in your IDE?
  1. <?php
  2. namespace Plugin\NZCustomPlugin\Event;
  3. use Eccube\Event\TemplateEvent;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. class NZCustomPluginEvent implements EventSubscriberInterface
  6. {
  7.     /**
  8.      * {@inheritdoc}
  9.      */
  10.     public static function getSubscribedEvents()
  11.     {
  12.         return [
  13.             'Mypage/login.twig' => 'onMypageLoginTwig',
  14.         ];
  15.     }
  16.     /**
  17.      * ログイン画面のテンプレートイベント
  18.      */
  19.     public function onMypageLoginTwig(TemplateEvent $event)
  20.     {
  21.         // フォームからのリダイレクトの場合、メッセージを追加
  22.         $parameters $event->getParameters();
  23.         
  24.         // JavaScriptでフォームへの案内メッセージを表示
  25.         $event->addSnippet('@NZCustomPlugin/default/login_message.twig');
  26.     }
  27. }