Tailor custom Content Fields load assets

I’m trying to create custom content fields via partials but I don’t know how to load the js and css assets?

I also tried the backend.layout.extendHead event, but I can’t link the assets path correctly.

Does anyone know I do this?

Hi @mcore

Take a look at Form Widgets, Content Fields can reference form widgets, including introducing assets, AJAX handlers, etc.

I load assets via the loadAssets function as in the form widget, but nothing happens.

If I understand it correctly, content fields help me extend the tailor model by type (jsonable, string,…), define for tailor list column, define for tailor filterScope. But the custom field must be based on form widgets or from the backend form widgets.

Content fields introduce field, column and scope definition to Tailor, and database columns, model validations, etc. Form widget is used for the form field definition, the same way a Filter widget can be used for the filter scope definition.

Without knowing too much detail about your implementation. Some general advice: When using a form widget, be sure to run the bindToController() method, this is the what injects the assets in to the page layout. Forms and Tailor should do this automatically, though…