English (United Kingdom)

apply_filters( 'vikappointments_after_save_{$type}', bool $status, array $data, bool $isNew, 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, $type, refers to the name of the table calling the hook. This means that, for example, the service table will trigger an hook called vikappointments_after_save_service. The name of the table is always equals to the base name of the file that declares the $table instance.

It is possible to read a list of supported types by looking at the files stored within the following directory:

/wp-content/plugins/vikappointments/admin/tables/

Parameters

$status

(bool)  True on success, false otherwise.

$data

(array)  The properties of the record that have been saved.

$isNew

(bool)  True in case the record has been created, false in case an existing record was updated.

$table

(JTable)  The table instance that handles the saving process.


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('vikappointments_after_save_{$type}', function($status, $data, $isNew, $table)
{
    /**
     * @todo do something after saving a record
     */

    return $status;
}, 10, 4);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-08-29
Helpful?
See Also: