The problem, addClass() is adding the classes from the subcomponent instead of the specified classes.
Example:
If I add a component to fractal like the following, which includes a subcomponent (see the include statement in the code below):
Component: card
Subcomponent - Button (in a separate component file)
{%
set button_classes = [
'field',
'btn',
'btn-primary'
]
%}
<div {{ attributes.addClass(button_classes, 'field--item') }}>{{ link }}</div>
What happens is that the below div from the card component gets populated with the value of button_classes, and not card_classes.
<div {{ attributes.addClass(card_classes) }}>
In other words, I end up with this generated html:
<div class="col-md-6">
<div class="field field--label- btn btn-primary field--item">
<div class="card-body">
This is a vertical card.
<div class="field field--label- btn btn-primary field--item"></div>
</div>
</div>
</div>
thank you @akempler for pointing this out. we will have a look into that. ATM there is no work around, since this is pretty much related to the fractl rendering stack.
The problem, addClass() is adding the classes from the subcomponent instead of the specified classes.
Example: If I add a component to fractal like the following, which includes a subcomponent (see the include statement in the code below): Component: card
Subcomponent - Button (in a separate component file)
What happens is that the below div from the card component gets populated with the value of button_classes, and not card_classes.
<div {{ attributes.addClass(card_classes) }}>
In other words, I end up with this generated html:
Is there a different approach I should be using?
Thanks.