Your cart is empty!
Init Day
public function onInitSpecialDay( mixed &$day, object $data ) : void
Fires while initializing a special day instance.
Description
Trigger hook to let external plugins construct the special day with those properties that they might have added.
Parameters
- &$day
-
(VRESpecialDay) The instance to construct with the details of the current special day.
- $data
-
(object) The object holding the database record of the current special day.
Return Value
None.
Example
The example below injects the status of the special day within the instance. It is assumed that a new published
column has been already introduced within the database table of the special days.
/**
* Trigger event to let external plugins construct the special day with
* those properties that they might have added.
*
* @param VRESpecialDay &$day The special day instance.
* @param object $data The database record of the special day.
*
* @return void
*/
public function onInitSpecialDay(&$day, $data)
{
// check published status
if (isset($data->published)) {
// inject status within special day
$this->published = (bool) $data->published;
}
}
Changelog
Version | Description |
---|---|
1.8.3 | Introduced. |
Last Update: 2023-12-29 14:15
Helpful?