Remove #tree and #attributes properties from LinkWidget::formElement on element of #type 'value'

Created on 11 October 2014, about 10 years ago
Updated 10 March 2023, over 1 year ago

Problem/Motivation

According to the Form API Reference an element of #type value can only use the properties #type and #value.

LinkWidget::formElement however defines #tree and #attributes. Especially the CSS class does not make any sense, since according to the FAPI reference a value is:

A form value that is internal to the form and never displayed to the screen.

    // Exposing the attributes array in the widget is left for alternate and more
    // advanced field widgets.
    $element['attributes'] = array(
      '#type' => 'value',
      '#tree' => TRUE,
      '#value' => !empty($items[$delta]->options['attributes']) ? $items[$delta]->options['attributes'] : array(),
      '#attributes' => array('class' => array('link-field-widget-attributes')),
    );

According to the patch #4 the attributes are need to migrate from Drupal 6. Then, we need to check how these attributes are used in D6 in order to check if they can be migrated as configuration data we already have in D8.

Proposed resolution

Remaining tasks

Check how attributes are used in D6 in order to check if they can be migrated as configuration data we already have in D8.

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

10.1

Component
Link 

Last updated 8 days ago

Created by

🇩🇪Germany derjochenmeyer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024