Search
public function onSearchSpecialDays( mixed $manager, mixed $day ) : bool
Fires while checking whether a special day can be used or not.
Description
Trigger hook to let external plugins apply additional filters while searching for a compatible special day. The filter applies once for each special day separately.
When this hook is triggered, the system already validated the standard conditions and the special day has been approved for the usage.
NOTE: it is possible to check for which section we are searching the special days by accessing the $manager->getGroup()
method. This method will return 1
for restaurant and 2
for take-away.
Parameters
- $manager
-
(VRESpecialDaysManager) The instance used to search the compatible special days.
- $day
-
(VRESpecialDay) The instance holding the details of the current special day.
Return Value
Boolean. Use false to discard the special day.
Example
The example below automatically discards all the special days that have been temporarily unpublished. 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 apply additional filters
* while seatching for a compatible special day.
*
* @param VRESpecialDaysManager $manager The manager instance.
* @param VRESpecialDay $day The special day instance.
*
* @return bool True to accept the payment, false to discard it.
*/
public function onSearchSpecialDays($manager, $day)
{
// check published status
if (isset($day->published) && $day->published == false) {
// unpublished special day, discard it
return false;
}
return true;
}
Changelog
Version | Description |
---|---|
1.8.3 | Introduced. |