Skip to content

[Twig/Forms] not possible to set title for button without text #34330

Closed
@poolerMF

Description

@poolerMF

Symfony version(s) affected: every ?

Description

  • I'm creating form button, that has only icon ... It's not possible to define title for button, that has no text

How to reproduce

$builder->add('reset', ResetType::class, [
	'label' => false,
	'attr' => [
		'title' => 'word.reset_filter'
	]
]);

My Solution
override block button_widget

{% block button_widget -%}
    {% set original_translation_domain = translation_domain %}
    ....
{%- endblock button_widget %}

override block button_attributes

{%- block button_attributes -%}
    {% set translation_domain = original_translation_domain %}
    id="{{ id }}" name="{{ full_name }}"{% if disabled %} disabled="disabled"{% endif -%}
    {{ block('attributes') }}
{%- endblock button_attributes -%}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions