Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TextfieldWidget.php

function TextfieldWidget::errorElement

Overrides WidgetBase::errorElement

File

core/modules/text/src/Plugin/Field/FieldWidget/TextfieldWidget.php, line 44

Class

TextfieldWidget
Plugin implementation of the 'text_textfield' widget.

Namespace

Drupal\text\Plugin\Field\FieldWidget

Code

public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, FormStateInterface $form_state) {
    if (isset($element['format']['#access']) && !$element['format']['#access'] && preg_match('/^[0-9]*\\.format$/', $violation->getPropertyPath())) {
        // Ignore validation errors for formats that may not be changed,
        // such as when existing formats become invalid.
        // See \Drupal\filter\Element\TextFormat::processFormat().
        return FALSE;
    }
    return $element;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal