public function onPopulateSmsPlaceholders(array &$data, mixed $order, string $tmpl) : void

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

&$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.

Return Value

None.


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   array   &$data  The array with the available tags.
 * @param   mixed   $order  The order details.
 * @param   string  $tmpl   The SMS template.
 *
 * @return  void
 */
public function onPopulateSmsPlaceholders(&$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');
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-08 16:38
Helpful?