1

I have a paragraph type defined as two fields, which are Person and Role.

I can customize the structure of the paragraph fine to view. However, I am stuck in editing how the form elements sit in the Edit screen.

Debugging the twig files indicates that the Theme Hook around these components is 'container' and not anything to do with 'paragraph'.

Is there either:
a. A way to specify a 'container.html.twig' file to render the paragraph's form?
b. A way to specify how the paragraph should render forms?

Is there something else I may have missed?

| improve this question | | | | |
0

Most edit forms utilize your current admin theme and form render arrays with according widget subforms.

So - in theory - you have several options:

(1) Provide your own admin theme with templates for your single forms. Using a contrib admin theme as base theme would make up for an easy start.

(2) Create a custom module and implement one of the many hooks that allow to alter your forms (e.g., hook_form_FORM_ID_alter, hook_field_widget_WIDGET_TYPE_form_alter, ...).

(3) If suitable, choose your front-end theme for editing your content. Then you can implement your templates there. For this, you'd want to implement a custom theme negotiator in a custom module.

In most cases however, the above methods are overly time-consuming.

To improve usability of back-end forms for content authors, have a look into the field_group module. It allows you to structure your back-end editable forms and displays. You can add groups like detail wrappers, horizontal/vertical tabs, and/or containers with custom HTML-elements and classes.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.