The curiosity came from when I was trying to remove the auto-truncate behaviour from a Promotional Card component, that is setup via the Paragraph Type. After inspecting its corresponding paragraph--civictheme-promo-card.html.twig
file, it seems the paragraph uses the SDC civictheme:promo-card
directly, without any with
statement to assign the variables/slots?
Adding {{dump()}}
statement shows that the variables used by the promo-card component somehow magically, are already in-place:
So after some digging, I found the place where the variables gets declared:
- the
civictheme.theme
has included the./includes/manual_list.inc
file - the
manual_list.inc
file have declared a theme hookcivictheme_preprocess_paragraph__civictheme_manual_list
that will be triggered before any paragraphcivictheme_manual_list
component loads in - this particular theme hook function calls a series of functions that stares with
_civictheme_preprocess_paragraph__paragraph_field__**
, which will extract the variables from thecontent
fields of the&$variables
. - Taking the
field_c_p_title
value undercontent
field for example, it will be declared as a separate fieldtitle
(extracted with the help ofcivictheme_get_field_value
function inutilities.inc
)