About FieldtypeBusinessHours

ProcessWire Fieldtype for entering business hours (opening hours)

Category 1Field Types
Fieldtype modules that represent a data type used by fields.
Category 2Input Fields
Inputfield modules that provide a UI input widget in the ProcessWire admin.
Release StateStable
Should be safe for use in production environments. *
Authors
Module Version0.0.1
Class NameFieldtypeBusinessHours
Compatibility3.0
Date AddedJanuary 18, 2018
Recommended ByNew recommendations may take up to 1 day to appear.

Instructions

This module's files should be placed in /site/modules/FieldtypeBusinessHours/
How to install or uninstall modules

README

Fieldtype Business Hours

ProcessWire Fieldtype for entering business hours (opening hours)

Input format

Per day one or multiple (comma separated) ranges can be entered:

9:00-12:00

9:00-12:00, 13:00-17:30

Leave a day empty when closed on that day

Usage in templates

Days are from 1 to 7 where 1 is Monday and 7 is Sunday (ISO-8601)

echo $page->field_name->isNowOpen() ? 'Now open' : 'Now closed';

if($page->field_name[1] == null) { echo 'Closed on Monday'; }

if($page->field_name[2]->inRange('11:00')) { echo 'Tuesday at 11:00 open'; }

echo $page->field_name[1];

echo $page->field_name[1]->getEntries()->getFrom()->format('H:i');

Comments

No comments yet. Be the first to post!

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.