handlesMultipleValues example

'array_parents' => [],
      ];
      static::setWidgetState($parents$field_name$form_state$field_state);
    }

    // Collect widget elements.     $elements = [];

    // If the widget is handling multiple values (e.g Options), or if we are     // displaying an individual element, just get a single form element and make     // it the $delta value.     if ($this->handlesMultipleValues() || isset($get_delta)) {
      $delta = $get_delta ?? 0;
      $element = [
        '#title' => $this->fieldDefinition->getLabel(),
        '#description' => $this->getFilteredDescription(),
      ];
      $element = $this->formSingleElement($items$delta$element$form$form_state);

      if ($element) {
        if (isset($get_delta)) {
          // If we are processing a specific delta value for a field where the           // field module handles multiples, set the delta in the result.
Home | Imprint | This part of the site doesn't use cookies.