Chris@0: isNew() is Chris@0: * TRUE), the 'default value', if any, is pre-populated. Also allows other Chris@0: * modules to alter the form element by implementing their own hooks. Chris@0: * Chris@0: * @param \Drupal\Core\Field\FieldItemListInterface $items Chris@0: * An array of the field values. When creating a new entity this may be NULL Chris@0: * or an empty array to use default values. Chris@0: * @param array $form Chris@0: * An array representing the form that the editing element will be attached Chris@0: * to. Chris@0: * @param \Drupal\Core\Form\FormStateInterface $form_state Chris@0: * The current state of the form. Chris@0: * @param int $get_delta Chris@0: * Used to get only a specific delta value of a multiple value field. Chris@0: * Chris@0: * @return array Chris@0: * The form element array created for this field. Chris@0: */ Chris@0: public function form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL); Chris@0: Chris@0: /** Chris@0: * Extracts field values from submitted form values. Chris@0: * Chris@0: * @param \Drupal\Core\Field\FieldItemListInterface $items Chris@0: * The field values. This parameter is altered by reference to receive the Chris@0: * incoming form values. Chris@0: * @param array $form Chris@0: * The form structure where field elements are attached to. This might be a Chris@0: * full form structure, or a sub-element of a larger form. Chris@0: * @param \Drupal\Core\Form\FormStateInterface $form_state Chris@0: * The form state. Chris@0: */ Chris@0: public function extractFormValues(FieldItemListInterface $items, array $form, FormStateInterface $form_state); Chris@0: Chris@0: /** Chris@0: * Reports field-level validation errors against actual form elements. Chris@0: * Chris@0: * @param \Drupal\Core\Field\FieldItemListInterface $items Chris@0: * The field values. Chris@0: * @param \Symfony\Component\Validator\ConstraintViolationListInterface $violations Chris@0: * A list of constraint violations to flag. Chris@0: * @param array $form Chris@0: * The form structure where field elements are attached to. This might be a Chris@0: * full form structure, or a sub-element of a larger form. Chris@0: * @param \Drupal\Core\Form\FormStateInterface $form_state Chris@0: * The form state. Chris@0: */ Chris@0: public function flagErrors(FieldItemListInterface $items, ConstraintViolationListInterface $violations, array $form, FormStateInterface $form_state); Chris@0: Chris@0: /** Chris@0: * Retrieves processing information about the widget from $form_state. Chris@0: * Chris@0: * This method is static so that it can be used in static Form API callbacks. Chris@0: * Chris@0: * @param array $parents Chris@0: * The array of #parents where the field lives in the form. Chris@0: * @param string $field_name Chris@0: * The field name. Chris@0: * @param \Drupal\Core\Form\FormStateInterface $form_state Chris@0: * The form state. Chris@0: * Chris@0: * @return array Chris@0: * An array with the following key/value pairs: Chris@0: * - items_count: The number of widgets to display for the field. Chris@0: * - array_parents: The location of the field's widgets within the $form Chris@0: * structure. This entry is populated at '#after_build' time. Chris@0: */ Chris@0: public static function getWidgetState(array $parents, $field_name, FormStateInterface $form_state); Chris@0: Chris@0: /** Chris@0: * Stores processing information about the widget in $form_state. Chris@0: * Chris@0: * This method is static so that it can be used in static Form API #callbacks. Chris@0: * Chris@0: * @param array $parents Chris@0: * The array of #parents where the widget lives in the form. Chris@0: * @param string $field_name Chris@0: * The field name. Chris@0: * @param \Drupal\Core\Form\FormStateInterface $form_state Chris@0: * The form state. Chris@0: * @param array $field_state Chris@0: * The array of data to store. See getWidgetState() for the structure and Chris@0: * content of the array. Chris@0: */ Chris@0: public static function setWidgetState(array $parents, $field_name, FormStateInterface $form_state, array $field_state); Chris@0: Chris@0: }