Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Closed
@poolerMF

Description

@poolerMF
Issue body actions

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.