Silverstripe Version: 4.6
When extending Model Admin search forms as seen in this forum post the rendered fields don’t use the set template.
For example:
$context->getFields()->push(Select2Field::create('Tags', 'Tags', Tags::get())->setMultiple(true));
Works when used in getCMSFields()
. It doesn’t in updateSearchContext()
.
I added some junk attributes in:
\Vendor\silverware\select2\templates\SilverWare\Select2\Forms\SelectField.ss
and it never shows so the field isn’t using it’s own template to render. It does in getCMSFields()
.
I tried to make it use my own template:
Select2Field::create('Tags', 'Tags', $tags)->setMultiple(true)->setTemplate('pita')
Where pita.ss
is in the templates directory - doesn’t use it. Does in getCMSFields()
.
I’ve tried to get this working instead using searchableFields()
and scaffoldSearchFields()
on the model which also doesn’t work.
I’ve also changed the field to a regular old DropdownField
and that also doesn’t use the template set by setTemplate()
.
setSmallFieldHolderTemplate()
also has no effect.
What can I do here?