Skip to content

Configurable templates#1316

Open
raffaelj wants to merge 2 commits intoagentejo:nextfrom
raffaelj:configurable-templates
Open

Configurable templates#1316
raffaelj wants to merge 2 commits intoagentejo:nextfrom
raffaelj:configurable-templates

Conversation

@raffaelj
Copy link
Contributor

@raffaelj raffaelj commented Jul 9, 2020

Singletons now have the same template functionality like collections, so existing singletons are proposed when hovering over "Add field" while creating a new singleton.

Collections and singletons can have custom templates in #config:collections/templates/*.php and #config:singletons/templates/*.php.

For collections: If the custom config templates folder exists, the folder collections:fields-templates will be ignored.

raffaelj added 2 commits July 9, 2020 15:12
Usage:
Create a folder `/config/collections/templates` and place your collection templates there.

foreach ($this->app->helper('fs')->ls('*.php', 'collections:fields-templates') as $file) {
$templatesPath = 'collections:fields-templates';
if ($customTemplatesPath = $this->path('#config:collections/templates')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not allow both? collect the paths in an array and then do a loop over the folders

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intentional to avoid naming conflicts and to have the ability to override the default template(s). If I choose to use custom templates I can still copy the core collection template to my template folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants