WidgetBase::afterBuild

public static WidgetBase::afterBuild(array $element, FormStateInterface $form_state) After-build handler for field elements in a form. This stores the final location of the field within the form structure so that flagErrors() can assign validation errors to the right form element. File core/lib/Drupal/Core/Field/WidgetBase.php, line 255 Class WidgetBase Base class for 'Field widget' plugin implementations. Namespace Drupal\Core\Field Code public static function afterBuild(array $elemen

WidgetBase::errorElement

public WidgetBase::errorElement(array $element, ConstraintViolationInterface $error, array $form, FormStateInterface $form_state) Assigns a field-level validation error to the right widget sub-element. Depending on the widget's internal structure, a field-level validation error needs to be flagged on the right sub-element. Parameters array $element: An array containing the form element for the widget, as generated by formElement(). \Symfony\Component\Validator\ConstraintViolationInterface $vio

WidgetBase::extractFormValues

public WidgetBase::extractFormValues(FieldItemListInterface $items, array $form, FormStateInterface $form_state) Extracts field values from submitted form values. Parameters \Drupal\Core\Field\FieldItemListInterface $items: The field values. This parameter is altered by reference to receive the incoming form values. array $form: The form structure where field elements are attached to. This might be a full form structure, or a sub-element of a larger form. \Drupal\Core\Form\FormStateInterface $

WidgetBase::flagErrors

public WidgetBase::flagErrors(FieldItemListInterface $items, ConstraintViolationListInterface $violations, array $form, FormStateInterface $form_state) Reports field-level validation errors against actual form elements. Parameters \Drupal\Core\Field\FieldItemListInterface $items: The field values. \Symfony\Component\Validator\ConstraintViolationListInterface $violations: A list of constraint violations to flag. array $form: The form structure where field elements are attached to. This might be

WidgetBase::form

public WidgetBase::form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL) Creates a form element for a field. If the entity associated with the form is new (i.e., $entity->isNew() is TRUE), the 'default value', if any, is pre-populated. Also allows other modules to alter the form element by implementing their own hooks. Parameters \Drupal\Core\Field\FieldItemListInterface $items: An array of the field values. When creating a new entity this

WidgetBase::formMultipleElements

protected WidgetBase::formMultipleElements(FieldItemListInterface $items, array &$form, FormStateInterface $form_state) Special handling to create form elements for multiple values. Handles generic features for multiple fields: number of widgets AHAH-'add more' button table display and drag-n-drop value reordering File core/lib/Drupal/Core/Field/WidgetBase.php, line 142 Class WidgetBase Base class for 'Field widget' plugin implementations. Namespace Drupal\Core\Field Code protec

WidgetBase::formSingleElement

protected WidgetBase::formSingleElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) Generates the form element for a single copy of the widget. File core/lib/Drupal/Core/Field/WidgetBase.php, line 313 Class WidgetBase Base class for 'Field widget' plugin implementations. Namespace Drupal\Core\Field Code protected function formSingleElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInter

WidgetBase::getFieldSetting

protected WidgetBase::getFieldSetting($setting_name) Returns the value of a field setting. Parameters string $setting_name: The setting name. Return value mixed The setting value. File core/lib/Drupal/Core/Field/WidgetBase.php, line 528 Class WidgetBase Base class for 'Field widget' plugin implementations. Namespace Drupal\Core\Field Code protected function getFieldSetting($setting_name) { return $this->fieldDefinition->getSetting($setting_name); }

WidgetBase::getFieldSettings

protected WidgetBase::getFieldSettings() Returns the array of field settings. Return value array The array of settings. File core/lib/Drupal/Core/Field/WidgetBase.php, line 515 Class WidgetBase Base class for 'Field widget' plugin implementations. Namespace Drupal\Core\Field Code protected function getFieldSettings() { return $this->fieldDefinition->getSettings(); }

WidgetBase::getFilteredDescription

protected WidgetBase::getFilteredDescription() Returns the filtered field description. Return value \Drupal\Core\Field\FieldFilteredMarkup The filtered field description, with tokens replaced. File core/lib/Drupal/Core/Field/WidgetBase.php, line 571 Class WidgetBase Base class for 'Field widget' plugin implementations. Namespace Drupal\Core\Field Code protected function getFilteredDescription() { return FieldFilteredMarkup::create(\Drupal::token()->replace($this->fieldDefiniti