In Grav admin, there is an event hook called onAdminSave
, which is triggered when you save a page. Is there a similar hook for flex objects, that allows manipulation of flex objects before they are written to the filesystem?
If you run grep -roHE --include=*.php "fireEvent\('[^']+'"
inside folder /user/plugins/flex-objects you will get the following named events:
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'
You also might want to take a look at this similar question on Grav's own forum: Admin Event Hook for Flex Object