Action Hooks
Action hooks allows you to react to something during code execution but does not modify anything. These are the native action hooks found in Devflow
:
set_auth_cookie
/**
* Fires immediately before the secure authentication cookie is set.
*
* @file App/Shared/Helpers/auth.php
* @param array $authCookie Authentication cookie.
* @param int $expire Duration in seconds the authentication cookie should be valid.
*/
Action::getInstance()->doAction('set_auth_cookie', $authCookie, $expire);
clear_auth_cookie
/**
* Fires just before the authentication cookies are cleared.
*
* @file App/Shared/Helpers/auth.php
*/
Action::getInstance()->doAction('clear_auth_cookie');
content_previous_status
/**
* Fires immediately before content is inserted into the content document.
*
* @param string $previousStatus Status of the content before it is created or updated.
* @param string $contentId The content's content_id.
* @param bool $update Whether this is an existing content or a new content.
*/
Action::getInstance()->doAction('content_previous_status', $previousStatus, $contentId, $update);
update_content
/**
* Action hook triggered after existing content has been updated.
*
* @param string $contentId Content id.
* @param array $content Content object.
*/
Action::getInstance()->doAction('update_content', $contentId, $content);
content_updated
/**
* Action hook triggered after existing content has been updated.
*
* @param string $contentId Content id.
* @param object $contentAfter Content object following the update.
* @param object $contentBefore Content object before the update.
*/
Action::getInstance()->doAction('content_updated', $contentId, $contentAfter, $contentBefore);
create_content
/**
* Action hook triggered after content is created.
*
* @param array $content Content object.
*/
Action::getInstance()->doAction('create_content', $content);
save_content_{$contentType}
/**
* Action hook triggered after content has been saved.
*
* The dynamic portion of this hook, `$contentType`, is the content's
* content type.
*
* @param string $contentId The content's id.
* @param array $content Content object.
* @param bool $update Whether this is an existing content or a new content.
*/
Action::getInstance()->doAction("save_content_{$contentType}", $contentId, $content, $update);
save_content_{$contentType}_{$contentStatus}
/**
* Action hook triggered after content has been saved.
*
* The dynamic portions of this hook, `$contentType` and `$contentStatus`,
* are the content's content type and status.
*
* @param string $contentId The content's id.
* @param array $content Content object.
* @param bool $update Whether this is existing content or new content.
*/
Action::getInstance()->doAction(
"save_content_{$contentType}_{$contentStatus}",
$contentId,
$content,
$update
);
cms_after_insert_content_data
/**
* Action hook triggered after content has been saved.
*
* @param string $contentId The content's id.
* @param object $content Content object.
* @param bool $update Whether this is existing content or new content.
*/
Action::getInstance()->doAction('cms_after_insert_content_data', $contentId, $content, $update);
before_delete_content
/**
* Action hook fires before a content is deleted.
*
* @param string $contentId Content id.
*/
Action::getInstance()->doAction('before_delete_content', $contentId);
delete_content
/**
* Action hook fires immediately before a content is deleted from the
* content document.
*
* @param string $contentId Content ID.
*/
Action::getInstance()->doAction('delete_content', $contentId);
deleted_content
/**
* Action hook fires immediately after a content is deleted from the content document.
*
* @param string $contentId Content id.
*/
Action::getInstance()->doAction('deleted_content', $contentId);
after_delete_content
/**
* Action hook fires after a content is deleted.
*
* @param string $contentId Content id.
*/
Action::getInstance()->doAction('after_delete_content', $contentId);
content_type_previous_slug
/**
* Fires immediately before a content_type is inserted into the content_type table.
*
* @file App/Shared/Helpers/content-type.php
* @param string $previousSlug Slug of the content before it was created.
* or updated.
* @param string $contentTypeId The content_type's content_type_id.
* @param bool $update Whether this is an existing content_type or a new content_type.
*/
Action::getInstance()->doAction('content_type_previous_slug', $previousSlug, $contentTypeId, $update);
update_content_type
/**
* Action hook triggered after existing content_type has been updated.
*
* @file App/Shared/Helpers/content-type.php
* @param string $contentTypeId Content Type id.
* @param object $contentType Content Type object.
*/
Action::getInstance()->doAction('update_content_type', $contentTypeId->toNative(), $contentType);
content_type_updated
/**
* Action hook triggered after existing content type has been updated.
*
* @file App/Shared/Helpers/content-type.php
* @param string $contentTypeId Content Type id.
* @param object $contentTypeAfter Content Type object following the update.
* @param object $contentTypeBefore Content Type object before the update.
*/
Action::getInstance()->doAction(
'content_type_updated',
$contentTypeId->toNative(),
$contentTypeAfter,
$contentTypeBefore
);
cms_after_insert_content_type_data
/**
* Action hook triggered after content_type has been saved.
*
* @file App/Shared/Helpers/content-type.php
* @param string $contentTypeId The content_type's id.
* @param array $contentType Content Type object.
* @param bool $update Whether this is an existing content_type or a new content_type.
*/
Action::getInstance()->doAction(
'cms_after_insert_content_type_data',
$contentTypeId,
$contentType,
$update
);
before_delete_content_type
/**
* Action hook fires before a content_type is deleted.
*
* @file App/Shared/Helpers/content-type.php
* @param string $contentTypeId ContentType id.
*/
Action::getInstance()->doAction('before_delete_content_type', $contentTypeId);
delete_content_type
/**
* Action hook fires immediately before a content_type is deleted from the
* content_type table.
*
* @file App/Shared/Helpers/content-type.php
* @param string $contentTypeId ContentType ID.
*/
Action::getInstance()->doAction('delete_content_type', $contentTypeId);
deleted_content_type
/**
* Action hook fires immediately after a content_type is deleted from the content_type table.
*
* @file App/Shared/Helpers/content-type.php
* @param string $contentTypeId ContentType id.
*/
Action::getInstance()->doAction('deleted_content_type', $contentTypeId);
after_delete_contenttype
/**
* Action hook fires after a content_type is deleted.
*
* @file App/Shared/Helpers/content-type.php
* @param string $contentTypeId ContentType id.
*/
Action::getInstance()->doAction('after_delete_contenttype', $contentTypeId);
product_previous_status
/**
* Fires immediately before product is inserted into the product document.
*
* @param string $previousStatus Status of the product before it is created or updated.
* @param string $productId The product's product_id.
* @param bool $update Whether this is an existing product or a new product.
*/
Action::getInstance()->doAction('product_previous_status', $previousStatus, $productId, $update);
pre_product_insert
/**
* Fires immediately before a product is inserted into the product document.
*
* @param Product $product Product object.
*/
Action::getInstance()->doAction('pre_product_insert', $product);
pre_product_update
/**
* Fires immediately before existing product is updated in the product document.
*
* @param string $productId Product id.
* @param product $product Product object.
*/
Action::getInstance()->doAction('pre_product_update', $productId, $product);
update_product
/**
* Action hook triggered after existing product has been updated.
*
* @param string $productId Product id.
* @param array $product Product object.
*/
Action::getInstance()->doAction('update_product', $productId, $product);
product_updated
/**
* Action hook triggered after existing product has been updated.
*
* @param string $productId Product id.
* @param object $productAfter Product object following the update.
* @param object $productBefore Product object before the update.
*/
Action::getInstance()->doAction('product_updated', $productId, $productAfter, $productBefore);
create_product
/**
* Action hook triggered after product is created.
*
* @param array $product Product object.
*/
Action::getInstance()->doAction('create_product', $product);
save_product_{$productSku}
/**
* Action hook triggered after product has been saved.
*
* The dynamic portion of this hook, `$productSku`, is the product's
* sku.
*
* @param string $productId The product's id.
* @param array $product Product object.
* @param bool $update Whether this is an existing product or a new product.
*/
Action::getInstance()->doAction("save_product_{$productSku}", $productId, $product, $update);
save_product_{$productSku}_{$productStatus}
/**
* Action hook triggered after product has been saved.
*
* The dynamic portions of this hook, `$productSku` and `$productStatus`,
* are the product's sku and status.
*
* @param string $productId The product's id.
* @param array $product Product object.
* @param bool $update Whether this is existing product or new product.
*/
Action::getInstance()->doAction(
"save_product_{$productSku}_{$productStatus}",
$productId,
$product,
$update
);
cms_after_insert_product_data
/**
* Action hook triggered after product has been saved.
*
* @param string $productId The product's id.
* @param object $product Product object.
* @param bool $update Whether this is existing product or new product.
*/
Action::getInstance()->doAction('cms_after_insert_product_data', $productId, $product, $update);
before_delete_product
/**
* Action hook fires before a product is deleted.
*
* @param string $productId Product id.
*/
Action::getInstance()->doAction('before_delete_product', $productId);
delete_product
/**
* Action hook fires immediately before a product is deleted from the
* product document.
*
* @param string $productId Product ID.
*/
Action::getInstance()->doAction('delete_product', $productId);
deleted_product
/**
* Action hook fires immediately after a product is deleted from the product document.
*
* @param string $productId Product id.
*/
Action::getInstance()->doAction('deleted_product', $productId);
after_delete_product
/**
* Action hook fires after a product is deleted.
*
* @param string $productId Product id.
*/
Action::getInstance()->doAction('after_delete_product', $productId);
site_previous_status
/**
* Fires immediately before a site is inserted into the site document.
*
* @file App/Shared/Helpers/site.php
* @param string $previousStatus Status of the site before it is created or updated.
* @param string $siteId The site's site_id.
* @param bool $update Whether this is an existing site or a new site.
*/
Action::getInstance()->doAction('site_previous_status', $previousStatus, $siteId, $update);
update_site
/**
* Fires immediately after an existing site is updated.
*
* @file App/Shared/Helpers/site.php
* @param string $siteId Site ID.
* @param Site $site Site data object.
*/
Action::getInstance()->doAction('update_site', $siteId, $site);
site_updated
/**
* Action hook triggered after existing site has been updated.
*
* @file App/Shared/Helpers/site.php
* @param string $siteId Site id.
* @param Site $siteAfter Site object following the update.
* @param Site $siteBefore Site object before the update.
*/
Action::getInstance()->doAction('site_updated', $siteId, $siteAfter, $siteBefore);
save_site
/**
* Fires immediately after a new site is saved.
*
* @file App/Shared/Helpers/site.php
* @param string $siteId Site ID.
* @param Site $site Site object.
* @param bool $update Whether this is an existing site or a new site.
*/
Action::getInstance()->doAction('save_site', $siteId, $site, $update);
save_site_{$siteStatus}
/**
* Action hook triggered after site has been saved.
*
* The dynamic portion of this hook, `$siteStatus`,
* is the site's status.
*
* @file App/Shared/Helpers/site.php
* @param string $siteId The site's id.
* @param Site $site Site object.
* @param bool $update Whether this is an existing site or a new site.
*/
Action::getInstance()->doAction("save_site_{$siteStatus}", $siteId, $site, $update);
cms_after_insert_site_data
/**
* Action hook triggered after site has been saved.
*
* @file App/Shared/Helpers/site.php
* @param string $siteId The site's id.
* @param Site $site Site object.
* @param bool $update Whether this is an existing site or a new site.
*/
Action::getInstance()->doAction('cms_after_insert_site_data', $siteId, $site, $update);
delete_site
/**
* Action hook triggered before the site is deleted.
*
* @file App/Shared/Helpers/site.php
* @param string $id Site ID.
* @param Site $oldSite Data object of site to be deleted.
*/
Action::getInstance()->doAction('delete_site', $siteId, $oldSite);
deleted_site
/**
* Action hook triggered after the site is deleted.
*
* @param string $siteId Site ID.
* @param Site $site Site object that was deleted.
*/
Action::getInstance()->doAction('deleted_site', $siteId, $site);
delete_site_user
/**
* Action hook fires immediately before a user is deleted from the usermeta document.
*
* @file App/Shared/Helpers/site.php
* @param string $userId ID of the user to delete.
* @param array $params User parameters (assign_id and role).
*/
Action::getInstance()->doAction('delete_site_user', $userId, $params);
deleted_site_user
/**
* Action hook fires immediately after a user has been deleted from the usermeta document.
*
* @file App/Shared/Helpers/site.php
* @param string $userId ID of the user who was deleted.
* @param array $params User parameters (assign_id and role).
*/
Action::getInstance()->doAction('deleted_site_user', $userId, $params);
profile_update
/**
* Fires immediately after an existing user is updated.
*
* @function App\Shared\Helpers\cms_insert_user()
*
* @file App/Shared/Helpers/user.php
* @param string $userId User ID.
* @param User $oldUserData Object containing user's data prior to update.
*/
Action::getInstance()->doAction('profile_update', $userId, $oldUserData);
user_register
/**
* Fires immediately after a new user is registered.
*
* @function App\Shared\Helpers\cms_insert_user()
*
* @file App/Shared/Helpers/user.php
* @param string $userId User ID.
*/
Action::getInstance()->doAction('user_register', $userId);
password_change_email
/**
* Fires when user is updated successfully.
*
* @function App\Shared\Helpers\cms_update_user()
*
* @file App/Shared/Helpers/user.php
* @param array $user The original user array before changes.
* @param string $plaintextPass Plaintext password before hashing.
* @param array $userdata The updated user array.
*/
Action::getInstance()->doAction('password_change_email', $user, $plaintextPass, $userdata);
email_change_email
/**
* Fires when user is updated successfully.
*
* @function App\Shared\Helpers\cms_update_user()
*
* @file App/Shared/Helpers/user.php
* @param array $user The original user array before changes.
* @param array $userdata The updated user array.
*/
Action::getInstance()->doAction('email_change_email', $user, $userdata);
cms_delete_user
/**
* Action hook fires immediately before a user is deleted from the user meta table.
*
* @function App\Shared\Helpers\cms_delete_user()
*
* @file App/Shared/Helpers/user.php
* @param string $userId ID of the user to delete.
* @param string|null $reassign ID of the user to reassign posts to.
* Default: NULL.
*/
Action::getInstance()->doAction('cms_delete_user', $userId, $assignId);
deleted_user
/**
* Action hook fires immediately after a user has been deleted from the user meta table.
*
* @function App\Shared\Helpers\cms_delete_user()
*
* @file App/Shared/Helpers/user.php
* @param string $userId ID of the user who was deleted.
* @param string $assignId ID of the user to whom posts were assigned. Default: null.
*/
Action::getInstance()->doAction('deleted_user', $userId, $assignId);
update_{$metaType}meta
/**
* Fires immediately before updating metadata of a specific type.
*
* The dynamic portion of the hook, `$metaType`, refers to the meta
* array type (content, user, or product).
*
* @class App\Shared\Services\MetaData
* @method update()
*
* @param string $metaId ID of the metadata entry to update.
* @param string $metaTypeId Array ID.
* @param string $metaKey Meta key.
* @param mixed $_metaValue Meta value.
*/
Action::getInstance()->doAction("update_{$metaType}meta", $metaId, $metaTypeId, $metaKey, $_metaValue);
updated_{$metaType}meta
/**
* Fires immediately after updating metadata of a specific type.
*
* The dynamic portion of the hook, `$metaType`, refers to the meta
* array type (content or user).
*
* @class App\Shared\Services\MetaData
* @method update()
*
* @param string $metaId ID of updated metadata entry.
* @param string $metaTypeId Array ID.
* @param string $metaKey Meta key.
* @param mixed $_metaValue Meta value.
*/
Action::getInstance()->doAction(
"updated_{$metaType}meta",
$metaId,
$metaTypeId,
$metaKey,
$_metaValue
);
add_{$metaType}meta
/**
* Fires immediately before meta of a specific type is added.
*
* The dynamic portion of the hook, `$metaType`, refers to the meta
* array type (content or user).
*
* @class App\Shared\Services\MetaData
* @method create()
*
* @param string $metaTypeId Array ID.
* @param string $metaKey Meta key.
* @param mixed $metaValue Meta value.
*/
Action::getInstance()->doAction("add_{$metaType}meta", $metaTypeId, $metaKey, $_metaValue);
added_{$metaType}meta
/**
* Fires immediately after meta of a specific type is added.
*
* The dynamic portion of the hook, `$metaType`, refers to the meta
* array type (content or user).
*
* @class App\Shared\Services\MetaData
* @method create()
*
* @param string $mid The meta ID after successful update.
* @param string $metaTypeId Array ID.
* @param string $metaKey Meta key.
* @param mixed $metaValue Meta value.
*/
Action::getInstance()->doAction("added_{$metaType}meta", $mid, $metaTypeId, $metaKey, $_metaValue);
delete_{$metaType}meta
/**
* Fires immediately before deleting metadata of a specific type.
*
* The dynamic portion of the hook, `$metaType`, refers to the meta
* array type (content or user).
*
* @class App\Shared\Services\MetaData
* @method delete()
*
* @param array $metaIds An array of metadata entry IDs to delete.
* @param string $metaTypeId Array ID.
* @param string $metaKey Meta key.
* @param mixed $metaValue Meta value.
*/
Action::getInstance()->doAction("delete_{$metaType}meta", $metaIds, $metaTypeId, $metaKey, $_metaValue);
deleted_{$metaType}meta
/**
* Fires immediately after deleting metadata of a specific type.
*
* The dynamic portion of the hook name, `$metaType`, refers to the meta
* array type (content or user).
*
* @class App\Shared\Services\MetaData
* @method delete()
*
* @param array $metaIds An array of deleted metadata entry IDs.
* @param string $metaTypeId Array ID.
* @param string $metaKey Meta key.
* @param mixed $metaValue Meta value.
*/
Action::getInstance()->doAction("deleted_{$metaType}meta", $metaIds, $metaTypeId, $metaKey, $_metaValue);