Admin Event Hooks

The Admin plugin has multiple event hooks that can be used during the Grav Lifecycle. See the general plugin documentation for using event hooks in the Plugins section.

Available Admin Event Hooks

Enabling an Admin Event Hook

Admin event hooks are called the same way that the core event hooks are called.


onAdminTaskExecute

The Admin plugin fires various tasks, depending on user interaction. Tasks might include logout, login, save, 2faverify, etc. After the task completes, this event hook fires.

onAdminCreatePageFrontmatter

While creating a new page, this event is fired after the header data is initially set to allow plugins to programmatically manipulate the frontmatter.

onAdminSave

Use admin event onAdminSave() to manipulate the page object data $obj before it is saved to the filesystem.

onAdminAfterSave

After saving the page in the administration panel, this event is fired.

onAdminAfterSaveAs

When creating a folder via the panel, this event fires immediately after creating the new folder and performing a standard cache clear.

onAdminAfterDelete

Fires after a page or folder is deleted. It is immediately followed by a standard cache clear.

onAdminAfterAddMedia

Fires after an add media task completes, but before the confirmation message is displayed.

onAdminAfterDelMedia

Fires after a delete media task completes, but before the confirmation message is displayed.