Skip to content

[2.7] No deprecation triggered for deprecated empty_value option #15908

Closed
@wouterj

Description

@wouterj

From UPGRADE-2.6.md:

  • The "empty_value" option in the types "choice", "date", "datetime" and "time"
    was deprecated and replaced by a new option "placeholder". You should use
    the option "placeholder" together with the view variables "placeholder" and
    "placeholder_in_choices" now.

    The option "empty_value" and the view variables "empty_value" and
    "empty_value_in_choices" will be removed in Symfony 3.0.

    Before:

    $form->add('category', 'choice', array(
        'choices' => array('politics', 'media'),
        'empty_value' => 'Select a category...',
    ));

    After:

    $form->add('category', 'choice', array(
        'choices' => array('politics', 'media'),
        'placeholder' => 'Select a category...',
    ));

    Before:

    {{ form.vars.empty_value }}
    
    {% if form.vars.empty_value_in_choices %}
        ...
    {% endif %}
    

    After:

    {{ form.vars.placeholder }}
    
    {% if form.vars.placeholder_in_choices %}
        ...
    {% endif %}
    

There is no deprecation notice triggered when still using this option in 2.7.

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