After Save
apply_filters( 'vikrestaurants_after_save_{$table}', bool $status, array $src, bool $is_new, JTable $table )
Fires after saving a record.
Description
This hook is triggered after creating or updating a record. External plugins can use this hook to perform further actions after saving a record.
The dynamic portion of the hook name, $table
, refers to the name of the table calling the hook. This means that, for example, the room table will trigger an hook called vikrestaurants_after_save_room
. The name of the table is always equals to the base name of the file that declares the $table
instance.
It is possible to fetch the name of a table by accessing the following folder:
/wp-content/plugins/vikrestaurants/admin/tables/
Parameters
- $status
-
(bool) True on success, false otherwise.
- $src
-
(array) The properties of the table that have been saved.
- $is_new
-
(bool) True in case of insert, false in case of update.
- $table
-
(JTable) The table instance.
Example
/**
* Trigger hook to allow the plugins to make something after
* saving a record.
*
* @param boolean $status True on success, false otherwise.
* @param mixed $data The saved record.
* @param boolean $isNew True if new, false in case of update.
* @param JTable $table The table instance.
*/
add_filter('vikrestaurants_after_save_{$type}', function($status, $data, $isNew, $table) {
/**
* @todo do something after saving a record
*/
return $status;
}, 10, 4);
Changelog
Version | Description |
---|---|
1.0 | Introduced. |
Last Update: 2023-12-15
Helpful?