craft3-templateselect
craft3-templateselect copied to clipboard
FR: Use autosuggest component for template selection
This fork changes the plugins form element to use the autosuggest component, which improves template selection through the improved UI.
@tomkiss Thanks for this PR! I didn't actually notice it until I did a major change where I added support for "beautifying" the paths and file names in the template select input.
Do you know if the autosuggest field has a way to control the rendering of the value?
Hi @sjelfull,
You can't really style as such, but you can provide a "hint" that will render in the field.
For example, when rendering a field normally, you can send it something like this:
'data' => ['Domestic Cat', 'Leopard', 'Lion']
But, you could use the hint property to improve what's displayed. Like so:
'data' => [
[
'name' => 'Domestic Cat',
'hint' => 'Your friend at home',
],
[
'name' => 'Leopard',
'hint' => 'Classic Apple operating system',
],
[
'name' => 'Lion',
'hint' => 'MGM',
]
]
...which would result in a UI that renders something like this:
So, you could lead with the template name, then hint the full path?