In the config array, you can set a new key "templates" to create one or multiple templates. The easiest way to do so, is like this:
This array will then create 2 templates for your Block Type. Be sure to use lowercase characters and underscores only for values and don't start/end with an underscore (minimum characters of 3).
If you've already taken a look at the "Assets" configuration, you may want to add assets directly for this template too maybe. Instead, set a key and a value and the value has to be an array. Within that array you can drop your assets like you would in the main config file.
In case you add assets after already creating a specific template, make sure you remove obsolete files. Since a template without assets will go straight into /templates (as your_template_handle.php), a template with assets will go into /templates/your_template_handle (as view.php). Same goes for the other way around if you first had assets and then want to remove them of course.
Whenever you add templates, the "view" array in a field is not being used for the specified templates. You'd have to define each of the variables, in case you want/need some. So let's take a look at an example for the Textarea field type.
You can see that for the normal view, we have set nl2br and skip_h to true. There is no prefix/suffix, so no HTML or code will be added before/after. This should generate the following output:
That's pretty clean and easy to see what's happening. Now let's take a look at the template "some_template".
There you can see the nl2br() is not there, and instead comes the h() wrapped around the value. Also some elements got added because of the prefix/suffix. This way you can style templates really how you'd want them to be.
Not yet available, on the todo-list.
Use, by you or one client, in a single end product. The total price includes the item price and a buyer fee.
Use, by you or a client, in 5 single end products. The total price includes the item price and a buyer fee.
Use, by you or a client, in x/xx single end products.
Upon request, quote will be made and sent to you via email.
Got something to say? Need help?
View support forum