Italian (Italy)
Knowledge Base  >  Vik Appointments  >  Hook  >  SMS  >  Populate Placeholders

apply_filters( 'vikappointments_populate_sms_placeholders', bool $status, array &$data, mixed $order, string $tmpl )

Fires while populating the SMS template.


Description

This hook can be used to extend/alter the value of the available placeholders that are going to be injected within a SMS template.

In example, by injecting a foo attribute, it will be possible to use the {foo} tag within the SMS template, which will be replaced by the value set into the array.


Parameters

$status

(bool)  True on success, false otherwise.

&$data

(array)  An associative array containing all the supported placeholders.

$order

(VAPOrderAppointment)  An object holding the details of the order.

$tmpl

(string)  The SMS template that will be used for the notification.


Example

/**
 * This event can be used to extend/alter the value of the available
 * placeholders that are going to be injected within a SMS template.
 *
 * @param  boolean  $status  True on success, false otherwise.
 * @param  array    &$data   The array with the available tags.
 * @param  mixed    $order   The order details.
 * @param  string   $tmpl    The SMS template.
 */
add_filter('vikappointments_populate_sms_placeholders', function($status, &$data, $order, $tmpl)
{
    // the {now} tag will include within the message the current date and time
    $data['now'] = JHtml::_('date', 'now', 'Y-m-d H:i:s');

    return $status;
}, 10, 4);

Changelog

Version Description
1.2 Introduced.
Ultimo aggiornamento: 2021-08-06
Utile?