Plugin screenshot thumbnail 1/1

Configuring Template Select

Create a new field and choose field type Template Select.

In the field settings, you can limit the list of available templates to a subfolder of the Craft templates folder. The path is relative, i.e. subfolder/anotherfolder. This may also be set to an ENV variable.

In the field settings, you can choose to make the template names more user friendly. In the field, the list will be improved by changing the following:

  • file extensions will be removed
  • the file names will be capitalized and spaced for readability
  • folders will be separated by ›

Using Template Select

Output the chosen template name:

{{ entry.fieldHandle }}

Include/Embed the chosen template:

{% include entry.fieldHandle %}

Include the template including subfolder if set:

{% include entry.fieldHandle.withSubfolder() %}

This is a alias for the following:

{{ entry.templateWithSubfolder.template(true) }}

Output the subfolder name:

{{ entry.fieldHandle.subfolder() }}

Output the filename without path:

{{ entry.fieldHandle.filename() }}
Installation Instructions

To install this plugin, copy the command above to your terminal.

Reviews

This plugin doesn't have any reviews.

Active Installs
516
Version
3.0.0
License
MIT
Compatibility
Craft 3, Craft 4, Craft 5
Last release
October 3, 2022
Categories
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs