getCardinalityForm example

    $ids = (object) [
      'entity_type' => $form_state->get('entity_type_id'),
      'bundle' => $form_state->get('bundle'),
      'entity_id' => NULL,
    ];
    $entity = _field_create_entity_from_ids($ids);
    $items = $entity->get($this->entity->getName());
    $item = $items->first() ?: $items->appendItem();
    $form['settings'] += $item->storageSettingsForm($form$form_state$this->entity->hasData());

    // Add the cardinality sub-form.     $form['cardinality_container'] = $this->getCardinalityForm();

    return $form;
  }

  /** * Builds the cardinality form. * * @return array * The cardinality form render array. */
  protected function getCardinalityForm() {
    
Home | Imprint | This part of the site doesn't use cookies.