You are here

protected function FieldStorageAddForm::configureEntityFormDisplay in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field_ui/src/Form/FieldStorageAddForm.php \Drupal\field_ui\Form\FieldStorageAddForm::configureEntityFormDisplay()

Configures the newly created field for the default view and form modes.

Parameters

string $field_name: The field name.

string|null $widget_id: (optional) The plugin ID of the widget. Defaults to NULL.

1 call to FieldStorageAddForm::configureEntityFormDisplay()
FieldStorageAddForm::submitForm in core/modules/field_ui/src/Form/FieldStorageAddForm.php
Form submission handler.

File

core/modules/field_ui/src/Form/FieldStorageAddForm.php, line 437
Contains \Drupal\field_ui\Form\FieldStorageAddForm.

Class

FieldStorageAddForm
Provides a form for the "field storage" add page.

Namespace

Drupal\field_ui\Form

Code

protected function configureEntityFormDisplay($field_name, $widget_id = NULL) {

  // Make sure the field is displayed in the 'default' form mode (using
  // default widget and settings). It stays hidden for other form modes
  // until it is explicitly configured.
  $options = $widget_id ? [
    'type' => $widget_id,
  ] : [];
  entity_get_form_display($this->entityTypeId, $this->bundle, 'default')
    ->setComponent($field_name, $options)
    ->save();
}