Loading office_hours.api.php +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,14 @@ function hook_office_hours_current_time_alter(int &$time, EntityInterface $entit // Add user timezone to time. // Assume that all owned entities (for example, offices) should // depend on user timezone. // Use case is a website as bulletin board. // Multiple accounts (clients) with different cities and timezones. // Client sets his timezone in his account data. // His articles (offices) have office hours with current status (open\closed). // Client sets it to e.g., 8:00-20:00. // Visitor chooses his city and wants to see if offices in this city are open. if ($entity instanceof \Drupal\user\EntityOwnerInterface && ($account = $entity->getOwner()) && ($account->isAuthenticated()) Loading Loading
office_hours.api.php +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,14 @@ function hook_office_hours_current_time_alter(int &$time, EntityInterface $entit // Add user timezone to time. // Assume that all owned entities (for example, offices) should // depend on user timezone. // Use case is a website as bulletin board. // Multiple accounts (clients) with different cities and timezones. // Client sets his timezone in his account data. // His articles (offices) have office hours with current status (open\closed). // Client sets it to e.g., 8:00-20:00. // Visitor chooses his city and wants to see if offices in this city are open. if ($entity instanceof \Drupal\user\EntityOwnerInterface && ($account = $entity->getOwner()) && ($account->isAuthenticated()) Loading