在Grav admin中,有一个名为onAdminSave
的事件钩子,当您保存页面时触发。flex对象是否有类似的钩子,允许在flex对象被写入文件系统之前对其进行操作?
如果你运行grep -roHE --include=*.php "fireEvent('[^']+'"
文件夹/user/plugins/flex-objects你会得到以下命名事件:
classes/FlexFormFactory.php: fireEvent('onBeforeFlexFormInitialize'
classes/Table/DataTable.php: fireEvent('onTwigSiteVariables'
classes/Admin/AdminController.php: fireEvent('onFlexTask'
classes/Admin/AdminController.php: fireEvent('onFlexAction'
classes/Admin/AdminController.php: fireEvent('onFlexAfterDelete'
classes/Admin/AdminController.php: fireEvent('onAdminAfterSaveAs'
classes/Admin/AdminController.php: fireEvent('onAdminCreatePageFrontmatter'
classes/Admin/AdminController.php: fireEvent('onFlexAfterSave'
classes/Controllers/ObjectController.php: fireEvent('gitsync'
classes/Controllers/MediaController.php: fireEvent('onAdminAfterAddMedia'
classes/Controllers/MediaController.php: fireEvent('onAdminAfterDelMedia'
flex-objects.php: fireEvent('onFlexInit'
flex-objects.php: fireEvent('onBeforeFlexFormInitialize'
你可能也想看看这个类似的问题在Grav自己的论坛:Admin Event Hook for Flex Object