function LinkWidget::massageFormValues

Same name in other branches
  1. 8.9.x core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php \Drupal\link\Plugin\Field\FieldWidget\LinkWidget::massageFormValues()
  2. 10 core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php \Drupal\link\Plugin\Field\FieldWidget\LinkWidget::massageFormValues()
  3. 11.x core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php \Drupal\link\Plugin\Field\FieldWidget\LinkWidget::massageFormValues()

Overrides WidgetBase::massageFormValues

File

core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php, line 415

Class

LinkWidget
Plugin implementation of the 'link' widget.

Namespace

Drupal\link\Plugin\Field\FieldWidget

Code

public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
    foreach ($values as &$value) {
        $value['uri'] = static::getUserEnteredStringAsUri($value['uri']);
        $value += [
            'options' => [],
        ];
    }
    return $values;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.