2.フック一覧について
WordPressのアクションフッのようなフック機能があるそうです。実装していて思ったのがこのフック一覧がほしいと言う事。私の方で一覧を見つけたので整理してみます。ECCUBE3の内部で処理中に割り込みの為のフックを入れるには以下のようなタイミングがあるようです。どの処理のどのタイミングにフックが可能かというのは、src/Controller/各Controller のソースに記載されており、例えばCartController.phpのindex()には、FRONT_CART_INDEX_INITIALIZEとFRONT_CART_INDEX_COMPLETEが定義されています。これらの定義元がsrc/Event/EccubeEvents.phpに定義されているので、参照すると以下のようなイベント記載が可能となります。Yaml形式で定義を書きますので、スペースやインデントに注意して記載していってください。
# ============================================= # ECCUBE全体フック # ============================================= eccube.event.app.before: - [onAppBefore, NORMAL] eccube.event.app.after: - [onAppAfter, NORMAL] eccube.event.controller.homepage.before: - [onControllerBefore, NORMAL] eccube.event.controller.homepage.after: - [onControllerAfter, NORMAL] eccube.event.controller.homepage.finish: - [onControllerFinish, NORMAL] eccube.event.render.homepage.before: - [onRenderBefore, NORMAL] # ============================================= # Admin/AdminContoller # ============================================= ### login admin.admin.login.initialize: - [onAdminLoginInitialize, NORMAL] ### index admin.admin.index.initialize: - [onAdminIndexOne, NORMAL] admin.admin.index.order: - [onAdminIndexTwo, NORMAL] admin.admin.index.sales: - [onAdminIndexThree, NORMAL] admin.admin.index.complete: - [onAdminIndexFour, NORMAL] ####################################### # searchNonStockProducts # Admin/Content/BlockController # index ####################################### admin.content.block.index.complete: - [onAdminContentBlockOne, NORMAL] # edit admin.content.block.edit.initialize: - [onAdminContentBlockTwo, NORMAL] admin.content.block.edit.complete: - [onAdminContentBlockThree, NORMAL] # delete admin.content.block.delete.complete: - [onAdminContentBlockFour, NORMAL] ####################################### # Admin/Content/FileController # index # create # delete # download # upload # Admin/Content/LayoutController # index ####################################### admin.content.layout.index.initialize: - [onAdminContentLayoutOne, NORMAL] admin.content.layout.index.complete: - [onAdminContentLayoutTwo, NORMAL] ####################################### # Admin/Content/NewsController # index ####################################### admin.content.news.index.initialize: - [onAdminContentNewsOne, NORMAL] # edit admin.content.news.edit.initialize: - [onAdminContentNewsThree, NORMAL] admin.content.news.edit.complete: - [onAdminContentNewsFour, NORMAL] # delete admin.content.news.delete.complete: - [onAdminContentNewsFive, NORMAL] ####################################### # Admin/Content/PageController # index ####################################### admin.content.page.index.initialize: - [onAdminContentPageOne, NORMAL] # edit admin.content.page.edit.initialize: - [onAdminContentPageTwo, NORMAL] admin.content.page.edit.complete: - [onAdminContentPageThree, NORMAL] # delete admin.content.page.delete.complete: - [onAdminContentPageFour, NORMAL] # Admin/Customer/CustomerController # index admin.customer.index.initialize: - [onAdminCustomerOne, NORMAL] admin.customer.index.search: - [onAdminCustomerTwo, NORMAL] # resend admin.customer.resend.complete: - [onAdminCustomerThree, NORMAL] # delete admin.customer.delete.complete: - [onAdminCustomerFour, NORMAL] # export # Admin/Customer/CustomerEditController # index admin.customer.edit.index.initialize: - [onAdminCustomerEditOne, NORMAL] admin.customer.edit.index.complete: - [onAdminCustomerEditTwo, NORMAL] # Admin/Order/EditController # index admin.order.edit.index.initialize: - [onAdminOrderEditOne, NORMAL] admin.order.edit.index.complete: - [onAdminOrderEditTwo, NORMAL] # searchCustomer admin.order.edit.search.customer.initialize: - [onAdminOrderEditThree, NORMAL] admin.order.edit.search.customer.search: - [onAdminOrderEditFour, NORMAL] admin.order.edit.search.customer.complete: - [onAdminOrderEditFive, NORMAL] # searchCustomerById admin.order.edit.search.customer.by.id.initialize: - [onAdminOrderEditSix, NORMAL] admin.order.edit.search.customer.by.id.complete: - [onAdminOrderEditSeven, NORMAL] # searchProduct admin.order.edit.search.product.initialize: - [onAdminOrderEditEight, NORMAL] admin.order.edit.search.product.search: - [onAdminOrderEditNine, NORMAL] admin.order.edit.search.product.complete: - [onAdminOrderEditTen, NORMAL] # Admin/Order/MailController # index admin.order.mail.index.initialize: - [onAdminMailOne, NORMAL] admin.order.mail.index.change: - [onAdminMailTwo, NORMAL] admin.order.mail.index.confirm: - [onAdminMailThree, NORMAL] admin.order.mail.index.complete: - [onAdminMailFour, NORMAL] # view admin.order.mail.view.complete: - [onAdminMailFive, NORMAL] # mailAll admin.order.mail.mail.all.initialize: - [onAdminMailSix, NORMAL] admin.order.mail.mail.all.change: - [onAdminMailSeven, NORMAL] admin.order.mail.mail.all.confirm: - [onAdminMailEight, NORMAL] admin.order.mail.mail.all.complete: - [onAdminMailNine, NORMAL] # Admin/Order/OrderController # index admin.order.index.initialize: - [onAdminOrderOne, NORMAL] admin.order.index.search: - [onAdminOrderTwo, NORMAL] # delete admin.order.delete.complete: - [onAdminOrderThree, NORMAL] # exportOrder # exportShipping # Admin/Product/CategoryController # index admin.product.category.index.initialize: - [onAdminCategoryOne, NORMAL] admin.product.category.index.complete: - [onAdminCategoryTwo, NORMAL] # delete admin.product.category.delete.complete: - [onAdminCategoryThree, NORMAL] # export # Admin/Product/ClassCategoryController # index admin.product.class.category.index.initialize: - [onAdminClassCategoryOne, NORMAL] admin.product.class.category.index.complete: - [onAdminClassCategoryTwo, NORMAL] # delete admin.product.class.category.delete.complete: - [onAdminClassCategoryThree, NORMAL] # Admin/Product/ClassNameController # index admin.product.class.name.index.initialize: - [onAdminClassNameOne, NORMAL] admin.product.class.name.index.complete: - [onAdminClassNameTwo, NORMAL] # delete admin.product.class.name.delete.complete: - [onAdminClassNameThree, NORMAL] # Admin/Product/CsvImportController # csvProduct # csvCatgory # csvTemplate # Admin/Product/ProductClassController # index admin.product.product.class.index.initialize: - [onAdminProductClassOne, NORMAL] admin.product.product.class.index.classes: - [onAdminProductClassTwo, NORMAL] # edit admin.product.product.class.edit.initialize: - [onAdminProductClassThree, NORMAL] admin.product.product.class.edit.complete: - [onAdminProductClassFour, NORMAL] admin.product.product.class.edit.update: - [onAdminProductClassFive, NORMAL] admin.product.product.class.edit.delete: - [onAdminProductClassSix, NORMAL] # Admin/Product/ProductController # index admin.product.index.initialize: - [onAdminProductOne, NORMAL] admin.product.index.search: - [onAdminProductTwo, NORMAL] # addImage admin.product.add.image.complete: - [onAdminProductThree, NORMAL] # edit admin.product.edit.initialize: - [onAdminProductFour, NORMAL] admin.product.edit.search: - [onAdminProductFive, NORMAL] admin.product.edit.complete: - [onAdminProductSix, NORMAL] # delete admin.product.delete.complete: - [onAdminProductSeven, NORMAL] # copy admin.product.copy.complete: - [onAdminProductEight, NORMAL] # display admin.product.display.complete: - [onAdminProductNine, NORMAL] # export # Admin/Setting/Shop/CsvController # index admin.setting.shop.csv.index.initialize: - [onAdminCsvOne, NORMAL] admin.setting.shop.csv.index.complete: - [onAdminCsvTwo, NORMAL] # Admin/Setting/Shop/CustomerAgreementController # index admin.setting.shop.customer.agreement.index.initialize: - [onAdminAgreeOne, NORMAL] admin.setting.shop.customer.agreement.index.complete: - [onAdminAgreeTwo, NORMAL] # Admin/Setting/Shop/DeliveryController # index admin.setting.shop.delivery.index.complete: - [onAdminDeliveryTwo, NORMAL] # edit admin.setting.shop.delivery.edit.initialize: - [onAdminDeliveryThree, NORMAL] admin.setting.shop.delivery.edit.complete: - [onAdminDeliveryFour, NORMAL] # delete admin.setting.shop.delivery.delete.complete: - [onAdminDeliverySix, NORMAL] # Admin/Setting/Shop/MailController # index admin.setting.shop.mail.index.initialize: - [onAdminShopMailOne, NORMAL] admin.setting.shop.mail.index.complete: - [onAdminShopMailTwo, NORMAL] # Admin/Setting/Shop/PaymentController # index admin.setting.shop.payment.index.complete: - [onAdminPaymentTwo, NORMAL] # edit admin.setting.shop.payment.edit.initialize: - [onAdminPaymentThree, NORMAL] admin.setting.shop.payment.edit.complete: - [onAdminPaymentFour, NORMAL] # imageAdd admin.setting.shop.payment.image.add.complete: - [onAdminPaymentSix, NORMAL] # delete admin.setting.shop.payment.delete.complete: - [onAdminPaymentEight, NORMAL] # Admin/Setting/Shop/ShopController # index admin.setting.shop.shop.index.initialize: - [onAdminShopOne, NORMAL] admin.setting.shop.shop.index.complete: - [onAdminShopTwo, NORMAL] # Admin/Setting/Shop/TaxRuleController # index admin.setting.shop.tax.rule.index.initialize: - [onAdminTaxOne, NORMAL] admin.setting.shop.tax.rule.index.complete: - [onAdminTaxTwo, NORMAL] # delete admin.setting.shop.tax.rule.delete.complete: - [onAdminTaxFour, NORMAL] # editParameter admin.setting.shop.tax.rule.edit.parameter.initialize: - [onAdminTaxFive, NORMAL] admin.setting.shop.tax.rule.edit.parameter.complete: - [onAdminTaxSix, NORMAL] # Admin/Setting/Shop/TradelawController # index admin.setting.shop.trade.law.index.initialize: - [onAdminTradeOne, NORMAL] admin.setting.shop.trade.law.index.complete: - [onAdminTradeTwo, NORMAL] # Admin/Setting/System/AuthorityController # index admin.setting.system.authority.index.initialize: - [onAdminAuthorityOne, NORMAL] admin.setting.system.authority.index.complete: - [onAdminAuthorityTwo, NORMAL] # Admin/Setting/System/LogController # index admin.setting.system.log.index.initialize: - [onAdminLogOne, NORMAL] admin.setting.system.log.index.complete: - [onAdminLogTwo, NORMAL] # Admin/Setting/System/MasterdataController # index admin.setting.system.log.index.initialize: - [onAdminMasterdataOne, NORMAL] admin.setting.system.log.index.formTwo.initialize: - [onAdminMasterdataTwo, NORMAL] admin.setting.system.log.index.complete: - [onAdminMasterdataThree, NORMAL] # edit admin.setting.system.masterdata.edit.initialize: - [onAdminMasterdataFour, NORMAL] admin.setting.system.masterdata.edit.form.initialize: - [onAdminMasterdataFive, NORMAL] admin.setting.system.masterdata.edit.complete: - [onAdminMasterdataSix, NORMAL] # Admin/Setting/System/MemberController # index admin.setting.system.member.index.initialize: - [onAdminMemberOne, NORMAL] # edit admin.setting.system.member.edit.initialize: - [onAdminMemberTwo, NORMAL] admin.setting.system.member.edit.complete: - [onAdminMemberThree, NORMAL] # delete admin.setting.system.member.delete.initialize: - [onAdminMemberFour, NORMAL] admin.setting.system.member.delete.complete: - [onAdminMemberFive, NORMAL] # Block/SearchProductController # index front.block.search.product.index.initialize: - [onBlockOne, NORMAL] # Mypage/ChangeController # index front.mypage.change.index.initialize: - [onMypageChangeOne, NORMAL] front.mypage.change.index.complete: - [onMypageChangeTwo, NORMAL] # Mypage/DeliveryController # edit front.mypage.delivery.edit.initialize: - [onMypageDeliveryOne, NORMAL] front.mypage.delivery.edit.complete: - [onMypageDeliveryTwo, NORMAL] # delete front.mypage.delete.complete: - [onMypageDeliveryFour, NORMAL] # Mypage/MypageController # login front.mypage.mypage.login.initialize: - [onMypageOne, NORMAL] # index front.mypage.mypage.index.search: - [onMypageTwo, NORMAL] # history front.mypage.mypage.history.initialize: - [onMypageThree, NORMAL] # order front.mypage.mypage.order.initialize: - [onMypageFour, NORMAL] front.mypage.mypage.order.complete: - [onMypageFive, NORMAL] # favorite front.mypage.mypage.favorite.search: - [onMypageSix, NORMAL] # delete front.mypage.mypage.delete.initialize: - [onMypageSeven, NORMAL] front.mypage.mypage.delete.complete: - [onMypageEight, NORMAL] # Mypage/WithdrawController # index front.mypage.withdraw.index.initialize: - [onWithdrawOne, NORMAL] front.mypage.withdraw.index.complete: - [onWithdrawTwo, NORMAL] # CartController # index front.cart.index.initialize: - [onCartOne, NORMAL] front.cart.index.complete: - [onCartTwo, NORMAL] # add front.cart.add.initialize: - [onCartThree, NORMAL] front.cart.add.complete: - [onCartFour, NORMAL] front.cart.add.exception: - [onCartFive, NORMAL] # up front.cart.up.initialize: - [onCartSix, NORMAL] front.cart.up.complete: - [onCartSeven, NORMAL] front.cart.up.exception: - [onCartEight, NORMAL] # down front.cart.down.initialize: - [onCartNine, NORMAL] front.cart.down.complete: - [onCartTen, NORMAL] front.cart.down.exception: - [onCartTenOne, NORMAL] # remove front.cart.remove.initialize: - [onCartTenTwo, NORMAL] front.cart.remove.complete: - [onCartTenThree, NORMAL] # buystep front.cart.buystep.initialize: - [onCartTenFour, NORMAL] front.cart.buystep.complete: - [onCartTenFive, NORMAL] # ContactController # index front.contact.index.initialize: - [onContactOne, NORMAL] front.contact.index.complete: - [onContactTwo, NORMAL] # EntryController # index front.entry.index.initialize: - [onEntryOne, NORMAL] front.entry.index.complete: - [onEntryTwo, NORMAL] # activate front.entry.activate.complete: - [onEntryFour, NORMAL] # ForgotController # index front.forgot.index.initialize: - [onForgotOne, NORMAL] front.forgot.index.complete: - [onForgotTwo, NORMAL] # reset front.reset.index.complete: - [onForgotFour, NORMAL] # ProductController # index front.product.index.initialize: - [onProductOne, NORMAL] front.product.index.search: - [onProductTwo, NORMAL] front.product.index.complete: - [onProductThree, NORMAL] front.product.index.disp: - [onProductFour, NORMAL] front.product.index.order: - [onProductFive, NORMAL] # detail front.product.detail.initialize: - [onProductSix, NORMAL] front.product.detail.favorite: - [onProductSeven, NORMAL] front.product.detail.complete: - [onProductEight, NORMAL] # ShoppingController # index # complete 買い物かご完了Controller front.shopping.index.initialize: - [onShoppingOne, NORMAL] # confirm front.shopping.confirm.initialize: - [onShoppingTwo, NORMAL] front.shopping.confirm.processing: - [onShoppingThree, NORMAL] front.shopping.confirm.complete: - [onShoppingFour, NORMAL] front.shopping.complete.initialize: - [onShoppingComplete, NORMAL] # delivery front.shopping.delivery.initialize: - [onShoppingSix, NORMAL] front.shopping.delivery.complete: - [onShoppingSeven, NORMAL] # payment front.shopping.payment.initialize: - [onShoppingEight, NORMAL] front.shopping.payment.complete: - [onShoppingNine, NORMAL] # shippingChange # shipping front.shopping.shipping.complete: - [onShoppingTen, NORMAL] # shippingEditChange # shippingEdit front.shopping.shipping.edit.initialize: - [onShoppingTenOne, NORMAL] front.shopping.shipping.edit.complete: - [onShoppingTenTwo, NORMAL] # customer front.shopping.customer.initialize: - [onShoppingTenThree, NORMAL] # login front.shopping.login.initialize: - [onShoppingTenFour, NORMAL] # nonmember front.shopping.nonmember.initialize: - [onShoppingTenFive, NORMAL] front.shopping.nonmember.complete: - [onShoppingTenSix, NORMAL] # shippingMultipleChange # shippingMultiple front.shopping.shipping.multiple.initialize: - [onShoppingTenSeven, NORMAL] front.shopping.shipping.multiple.complete: - [onShoppingTenEight, NORMAL] # shippingMultipleEdit front.shopping.shipping.multiple.edit.initialize: - [onShoppingTenNine, NORMAL] front.shopping.shipping.multiple.edit.complete: - [onShoppingTwoZero, NORMAL] # shippingError front.shopping.shipping.error.complete: - [onShoppingTwoOne, NORMAL] # UserDataController # index front.user.data.index.initialize: - [onUserDataOne, NORMAL] # MailService mail.customer.confirm: - [onMailOne, NORMAL] mail.customer.complete: - [onMailTwo, NORMAL] mail.customer.withdraw: - [onMailThree, NORMAL] mail.contact: - [onMailFour, NORMAL] mail.order: - [onMailFive, NORMAL] mail.admin.customer.confirm: - [onMailSix, NORMAL] mail.admin.order: - [onMailSeven, NORMAL] mail.password.reset: - [onMailEight, NORMAL] mail.password.reset.complete: - [onMailNine, NORMAL]
また、画面表示前のフィルターフックのようなものもあります。各テンプレートへのパスとイベント名の定義があればよさそうです。
################################################## ## Template ################################################## Admin/Order/edit.twig: - [onadmin_order_deit_twig, NORMAL] block.twig: - [onblock_twig, NORMAL] default_frame.twig: - [ondefault_frame_twig, NORMAL] error.twig: - [onerror_twig, NORMAL] index.twig: - [onindex_twig, NORMAL] pagination.twig: - [onpagination_twig, NORMAL] Block/cart.twig: - [onBlock_cart_twig, NORMAL] Block/category.twig: - [onBlock_category_twig, NORMAL] Block/footer.twig: - [onBlock_footer_twig, NORMAL] Block/free.twig: - [onBlock_free_twig, NORMAL] Block/garally.twig: - [onBlock_garally_twig, NORMAL] Block/login.twig: - [onBlock_login_twig, NORMAL] Block/logo.twig: - [onBlock_logo_twig, NORMAL] Block/new_product.twig: - [onBlock_new_product_twig, NORMAL] Block/news.twig: - [onBlock_news_twig, NORMAL] Block/search_product.twig: - [onBlock_search_product_twig, NORMAL] Cart/index.twig: - [onCart_index_twig, NORMAL] Contact/complete.twig: - [onContact_complete_twig, NORMAL] Contact/confirm.twig: - [onContact_confirm_twig, NORMAL] Contact/index.twig: - [onContact_index_twig, NORMAL] Entry/activate.twig: - [onEntry_activate_twig, NORMAL] Entry/complete.twig: - [onEntry_complete_twig, NORMAL] Entry/confirm.twig: - [onEntry_confirm_twig, NORMAL] Entry/index.twig: - [onEntry_index_twig, NORMAL] Forgot/complete.twig: - [onForgot_complete_twig, NORMAL] Forgot/index.twig: - [onForgot_index_twig, NORMAL] Forgot/reset.twig: - [onForgot_reset_twig, NORMAL] Form/form_layout.twig: - [onForm_form_layout_twig, NORMAL] Help/about.twig: - [onHelp_about_twig, NORMAL] Help/agreement.twig: - [onHelp_agreement_twig, NORMAL] Help/guide.twig: - [onHelp_guide_twig, NORMAL] Help/privacy.twig: - [onHelp_privacy_twig, NORMAL] Help/tradelaw.twig: - [onHelp_tradelaw_twig, NORMAL] Mail/contact_mail.twig: - [onMail_contact_mail_twig, NORMAL] Mail/customer_withdraw_mail.twig: - [onMail_customer_withdraw_mail_twig, NORMAL] Mail/entry_complete.twig: - [onMail_entry_complete_twig, NORMAL] Mail/entry_confirm.twig: - [onMail_entry_confirm_twig, NORMAL] Mail/forgot_mail.twig: - [onMail_forgot_mail_twig, NORMAL] Mail/order.twig: - [onMail_order_twig, NORMAL] Mail/reset_complete_mail.twig: - [onMail_reset_complete_mail_twig, NORMAL] Mypage/change.twig: - [onMypage_change_twig, NORMAL] Mypage/change_complete.twig: - [onMypage_change_complete_twig, NORMAL] Mypage/delivery.twig: - [onMypage_delivery_twig, NORMAL] Mypage/delivery_edit.twig: - [onMypage_delivery_edit_twig, NORMAL] Mypage/favorite.twig: - [onMypage_favorite_twig, NORMAL] Mypage/index.twig: - [onMypage_index_twig, NORMAL] Mypage/login.twig: - [onMypage_login_twig, NORMAL] Mypage/navi.twig: - [onMypage_navi_twig, NORMAL] Mypage/withdraw.twig: - [onMypage_withdraw_twig, NORMAL] Mypage/withdraw_complete.twig: - [onMypage_withdraw_complete_twig, NORMAL] Mypage/withdraw_confirm.twig: - [onMypage_withdraw_confirm_twig, NORMAL] Mypage/history.twig: - [onRenderMypageHistoryTwigIndexRender, NORMAL] Product/list.twig: - [onProduct_list_twig, NORMAL] Shopping/index.twig: - [onShopping_index_twig, NORMAL] Shopping/login.twig: - [onShopping_login_twig, NORMAL] Shopping/nonmember.twig: - [onShopping_nonmember_twig, NORMAL] Shopping/shipping.twig: - [onShopping_shipping_twig, NORMAL] Shopping/shipping_edit.twig: - [onShopping_shipping_edit_twig, NORMAL] Shopping/shipping_multiple.twig: - [onShopping_shipping_multiple_twig, NORMAL] Shopping/shipping_multiple_edit.twig: - [onShopping_shipping_multiple_edit_twig, NORMAL] Shopping/shopping_error.twig: - [onShopping_shopping_error_twig, NORMAL] Shopping/complete.twig: - [onShopping_complete_twig, NORMAL] Product/detail.twig: - [onProductDetail, NORMAL]
プラグイン開発時は、event.yml にフックイベントを記載していきますが、記載だけでは反映されず一度以下のコマンドでuninstallして再度install⇒有効化する必要があります。