public function onCheckServiceVisibility(object $service, string $date) : void

Fires while checking whether a service is published or not.


Description 

This hook can be used to apply additional conditions while checking whether the specified service is published or not.

When this hook is triggered, the system already validated the standard conditions and the service is going to be used by the website.


Parameters

$service

(object)  The service to check. 

$date

(string)  The UTC check-in date in military format (Y-m-d H:i:s).

Return Value

Boolean. False to hide the service.


Example

/**
 * This hook can be used to apply additional conditions while checking whether
 * the specified service is published or not. When this hook is triggered, the
 * system already validated the standard conditions and the service is going
 * to be used by the website.
 *
 * @param   object   $service  The service to check.
 * @param   string   $date     The check-in date (UTC).
 *
 * @return  boolean  False to hide the service.
 */
public function onCheckServiceVisibility($service, $date)
{
    /**
     * @todo apply some custom validations
     */

    return true;
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-08 15:40
Helpful?