-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Describe the bug
With the new Button component action buttons without label rendered wrong.
To Reproduce
public function configureActions(Actions $actions): Actions
{
$testAction = Action::new('test')
->linkToUrl('#')
->setIcon('text-dark fa-fw fa-solid fa-bug')
->setLabel(false);
return $actions
->add(Crud::PAGE_INDEX, $testAction);
}results:
<a class="btn btn-secondary action-test" href="#" role="button" data-action-name="test" title="test">
<span class="icon btn-icon">
<i class="text-dark fa-fw fa-solid fa-bug"></i>
</span>
<span class="btn-label"></span>
</a>an extra <span class="btn-label"></span> here
(OPTIONAL) Additional context
in crud/action.html.twig
{%- if outerScope.action.label is not empty -%}<span class="action-label">{{ outerScope.action.label|trans|raw }}</span>{%- endif -%}does not render an extra <span class="action-label"></span> but makes content defined for Button component, so {% if block('content') is defined %} evaluates to true and renders the extra empty <span class="btn-label"></span>
changing {% if block('content') is defined %} to {% if block('content') is defined and block('content') is not empty %} does fix the rendering
<a class="btn btn-secondary action-test" href="#" role="button" data-action-name="test" title="test">
<span class="icon btn-icon">
<i class="text-dark fa-fw fa-solid fa-bug"></i>
</span>
</a>Metadata
Metadata
Assignees
Labels
No labels