Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable templates #1316

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

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.

Usage:
Create a folder `/config/collections/templates` and place your collection templates there.
@@ -105,7 +105,12 @@ public function collection($name = null) {
// get field templates
$templates = [];

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