supportsGroups example

$context = [
        'fieldDefinition' => $this->fieldDefinition,
        'entity' => $entity,
        'widget' => $this,
      ];
      $module_handler->alter('options_list', $options$context);

      array_walk_recursive($options[$this, 'sanitizeLabel']);

      // Options might be nested ("optgroups"). If the widget does not support       // nested options, flatten the list.       if (!$this->supportsGroups()) {
        $options = OptGroup::flattenOptions($options);
      }

      $this->options = $options;
    }
    return $this->options;
  }

  /** * Determines selected options from the incoming field values. * * @param \Drupal\Core\Field\FieldItemListInterface $items * The field values. * * @return array * The array of corresponding selected options. */
Home | Imprint | This part of the site doesn't use cookies.