WidgetInterface::settingsSummary

public WidgetInterface::settingsSummary() Returns a short summary for the current widget settings. If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings. Return value array A short summary of the widget settings. File core/lib/Drupal/Core/Field/WidgetInterface.php, line 46 Class WidgetInterface Interface definition for field widget plugins. Namespace Drupal\Core\Field Code public function settingsSummary();

WidgetInterface::settingsForm

public WidgetInterface::settingsForm(array $form, FormStateInterface $form_state) Returns a form to configure settings for the widget. Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the widget. The field_ui module takes care of handling submitted form values. Parameters array $form: The form where the settings form is being included in. \Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Return value array The form de

WidgetInterface::massageFormValues

public WidgetInterface::massageFormValues(array $values, array $form, FormStateInterface $form_state) Massages the form values into the format expected for field values. Parameters array $values: The submitted form values produced by the widget. If the widget does not manage multiple values itself, the array holds the values generated by the multiple copies of the $element generated by the formElement() method, keyed by delta. If the widget manages multiple values, the array holds the values o

WidgetInterface::isApplicable

public static WidgetInterface::isApplicable(FieldDefinitionInterface $field_definition) Returns if the widget can be used for the provided field. Parameters \Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition that should be checked. Return value bool TRUE if the widget can be used, FALSE otherwise. File core/lib/Drupal/Core/Field/WidgetInterface.php, line 159 Class WidgetInterface Interface definition for field widget plugins. Namespace Drupal\Core\Fiel

WidgetInterface::errorElement

public WidgetInterface::errorElement(array $element, ConstraintViolationInterface $violation, 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\ConstraintViolationInter

WidgetInterface

Interface definition for field widget plugins. This interface details the methods that most plugin implementations will want to override. See Drupal\Core\Field\WidgetBaseInterface for base wrapping methods that should most likely be inherited directly from Drupal\Core\Field\WidgetBase.. Hierarchy interface \Drupal\Component\Plugin\PluginInspectionInterface; interface \Drupal\Core\Config\Entity\ThirdPartySettingsInterfaceinterface \Drupal\Core\Field\PluginSettingsInterfaceinterface \Drupal\Core\

WidgetInterface::formElement

public WidgetInterface::formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) Returns the form for a single field widget. Field widget form elements should be based on the passed-in $element, which contains the base form element properties derived from the field configuration. The BaseWidget methods will set the weight, field name and delta values for each form element. If there are multiple values for this field, the formElement()

WidgetBaseInterface::setWidgetState

public static WidgetBaseInterface::setWidgetState(array $parents, $field_name, FormStateInterface $form_state, array $field_state) Stores processing information about the widget in $form_state. This method is static so that it can be used in static Form API #callbacks. Parameters array $parents: The array of #parents where the widget lives in the form. string $field_name: The field name. \Drupal\Core\Form\FormStateInterface $form_state: The form state. array $field_state: The array of data to

WidgetBaseInterface::extractFormValues

public WidgetBaseInterface::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\FormStateIn

WidgetBaseInterface::form

public WidgetBaseInterface::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 ent