zomars / bolt-store-hours Goto Github PK
View Code? Open in Web Editor NEWAn extension to add business hours as a field type within Bolt
An extension to add business hours as a field type within Bolt
It would be nice to add a TWIG function that requires a template file or uses a default template file specified in the config.yml.dist that allows the user to output data by default like this -
{% for hour in store_hours_hours_today(record.hours) %}
{% set this_day_hours = hour|split('-') %}
Open: {{ this_day_hours[0]|date('g:i a') }}
Close: {{ this_day_hours[1]|date('g:i a') }}
{% endfor %}
or maybe it shows an example of outputting each one based upon the day....
Monday - Friday 7am to 3:30pm
Sunday - Closed
After Hours Support is Available
Then you could call a function outputStoreHoursFormatted(twigTemplate = defaut.twig)
.
Uncaught Exception: Twig_Error_Runtime
Twig_Error_Runtime in Template.php line 447:
An exception has been thrown during the rendering of a template ("Warning: json_decode() expects parameter 1 to be string, array given") in "fields/_hourspicker.twig" at line 32.
Steps to reproduce
I am trying to set up Store HOurs in Bolt 3.4.5 on CentOS PHP7
I add:
business:
name: Businesses
singular_name: Business
fields:
hours:
type: storehours
Then it tells me to update the database, which I do, but when I try to add my business hours, it throws an error.
Modifications made to the database:
Table bolt_business is not the correct schema: invalid column hours, invalid column hours
Am I adding the content type (exactly as above) correctly?
If users use this as a repeating field it will not work. (Although, I don't know why you would need to) You should not include JS in the field type as you have done. I would include it in an external script and carry the attributes or options through data attributes. The repeating field uses text/templates
and will break any field types with script
in them. I would recommend doing something similar to this - https://github.com/Raistlfiren/FAIconFieldType
I would also recommend removing https://github.com/zomars/bolt-store-hours/blob/master/src/StoreHoursExtension.php#L35 so it displays
/**
* {@inheritdoc}
*/
protected function registerTwigPaths()
{
return [
'templates',
];
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.