I have a repeatable paragraph in which I have several fields. I use it to build a table.
The Manage Display is set to the order I want the fields inside the repeatable paragraphs.
If I render this field the Drupal way in Twig then it outputs the data, in the correct order, but I can't access the individual fields to add custom mark up I need. I would like to loop through the fields separately in Twig or a module/theme PHP.
BUT... if I obtain the fields in the theme/module or even Twig using something like this:
$paragraph->getFields()
then the fields do not come out in the Manage Display order. They come out in another and wrong order.
If I inspect the Paragraph object, there is a render field for #fields which lists them in the right order, but I just cant seem to extract the data in this field. I have no idea how to access #fields. The above method getFields() seems to get the exact same as what getFieldDefinitions() does and neither are in the correct order.
There is no "weight" data either that I could use to put them in the right order. I can't find anything I can access to allow me to put the fields in the right order.
Does anyone have a solution for this?
Thanks