{"id":271,"date":"2021-09-18T14:48:46","date_gmt":"2021-09-18T05:48:46","guid":{"rendered":"http:\/\/syrup-factory.com\/memo\/?p=271"},"modified":"2021-09-18T15:01:54","modified_gmt":"2021-09-18T06:01:54","slug":"eccube4-twig-%e4%bb%bb%e6%84%8f%e3%81%ae%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%81%ae%e3%83%86%e3%83%b3%e3%83%97%e3%83%ac%e3%83%bc%e3%83%88%e3%82%92%e8%aa%ad%e3%81%bf%e8%be%bc","status":"publish","type":"post","link":"https:\/\/syrup-factory.com\/memo\/archives\/271","title":{"rendered":"Eccube4 twig \u4efb\u610f\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u8aad\u307f\u8fbc\u3080"},"content":{"rendered":"\n<p>Eccube4 twig\uff1a \u4efb\u610f\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u8aad\u307f\u8fbc\u3080\u306b\u306f\u3001loader\u3067\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308c\u3070OK\u3002<\/p>\n<p>\u76f8\u5bfe\u30d1\u30b9\u6307\u5b9a\u3082\u7d76\u5bfe\u30d1\u30b9\u6307\u5b9a\u3082\u3067\u304d\u305a\u3068\u3066\u3082\u56f0\u3063\u3066\u3044\u305f\u30fb\u30fb\u30fb\u304c\u3001\u3053\u308c\u3067\u89e3\u6c7a\u3002<\/p>\n<p>\u30a4\u30d9\u30f3\u30c8\u3067\u66f8\u3044\u305f\u5834\u5408\uff1a\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\nclass HogehogeEvent implements EventSubscriberInterface\n{\n    \/**\n     * @var EccubeConfig\n     *\/\n    protected $eccubeConfig;\n\n    \/**\n     * @var EntityManagerInterface\n     *\/\n    private $entityManager;\n\n    \/**\n     * @var AuthorizationCheckerInterface\n     *\/\n    protected $authorizationChecker;\n\n    \/**\n     * @var TokenStorageInterface\n     *\/\n    protected $tokenStorage;\n\n    \/**\n     * @var Router\n     *\/\n\n    private $router;\n\n    \/**\n     * ContactChatEvent constructor.\n     *\/\n    public function __construct(\n        EccubeConfig $eccubeConfig,\n        EntityManagerInterface $entityManager,\n        AuthorizationCheckerInterface $authorizationChecker,\n        TokenStorageInterface $tokenStorage,\n        CampaignRepository $campaignRepository,\n        OrderReferRepository $orderReferRepository,\n        Router $router,\n        \\Twig_Environment $twig\n        \n    )\n    {\n        $this-&gt;eccubeConfig  = $eccubeConfig;\n        $this-&gt;entityManager = $entityManager;\n        $this-&gt;authorizationChecker = $authorizationChecker;\n        $this-&gt;tokenStorage = $tokenStorage;\n        $this-&gt;router = $router;\n        $this-&gt;twig = $twig;\n\n        \/\/ hogehoge\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30d1\u30b9\u3092\u8a2d\u5b9a\u3059\u308b\n        $this-&gt;twig-&gt;getLoader()-&gt;addPath(&#039;app\/template\/hogehoge&#039;, &#039;hogehoge_template&#039;);\n    }\n\n    \/**\n     * @return array\n     *\/\n    public static function getSubscribedEvents()\n    {\n        return [\n            \/\/hogehoge\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3067\u304d\u308b\n            &#039;@hogehoge\/Admin\/Order\/edit.twig&#039; =&gt; [&#039;AdminOrderEdit&#039;, 99],\n        ];\n    }\n\n    public function AdminOrderEdit(TemplateEvent $event) {\n        $source = $this-&gt;twig-&gt;getLoader()\n                \/\/ hogehoge \u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\n                -&gt;getSourceContext(&quot;@hogehoge\/Admin\/Order\/edit.twig&quot;)  \n                -&gt;getCode();\n\n        $source = $this-&gt;twig-&gt;getLoader()\n                \/\/ \u2605Eccube\u3067\u6307\u5b9a\u3057\u305f\u30c7\u30d5\u30a9\u30eb\u30c8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\n                -&gt;getSourceContext(&quot;@__main__\/Admin\/Order\/edit.twig&quot;) \n                -&gt;getCode();\n        $event-&gt;setSource($source);\n    }\n<\/pre><\/p>\n\n<p>@__main__ \u306f\u2605Eccube\u3067\u6307\u5b9a\u3057\u305f\u30c7\u30d5\u30a9\u30eb\u30c8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3002\uff08\u6b63\u78ba\u306b\u306f\u512a\u5148\u9806\u306e\u914d\u5217\u3068\u306a\u3063\u3066\u3044\u3066\u3001\u5148\u982d\u304c\u6307\u5b9a\u3057\u305f\u3082\u306e\u3002\uff09<\/p>\n<p>\u3061\u306a\u307f\u306b\u4e0a\u8a18\u30b3\u30fc\u30c9\u306f\u3001\u7279\u5b9a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u5185\u5bb9\u3067\u3054\u305d\u3063\u3068\u5165\u308c\u66ff\u3048\u3066\u3044\u308b\u3002<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Eccube4 twig\uff1a \u4efb\u610f\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u8aad\u307f\u8fbc\u3080\u306b\u306f\u3001loader\u3067\u30d1\u30b9\u3092\u6307\u5b9a &#8230;<\/p>\n<p> <a class=\"continue-reading-link\" href=\"https:\/\/syrup-factory.com\/memo\/archives\/271\"><span>Continue reading<\/span><i class=\"crycon-right-dir\"><\/i><\/a> <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,14],"tags":[],"_links":{"self":[{"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/posts\/271"}],"collection":[{"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/comments?post=271"}],"version-history":[{"count":8,"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/posts\/271\/revisions"}],"predecessor-version":[{"id":314,"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/posts\/271\/revisions\/314"}],"wp:attachment":[{"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/media?parent=271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/categories?post=271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/syrup-factory.com\/memo\/wp-json\/wp\/v2\/tags?post=271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}