You are here

protected function ExifSettingsController::configureEntityFormDisplay in Exif 8

Same name and namespace in other branches
  1. 8.2 src/Controller/ExifSettingsController.php \Drupal\exif\Controller\ExifSettingsController::configureEntityFormDisplay()

Ensure field is visible in default form.

Parameters

string $field_name: Name of the field to add to the view.

int $widget_id: Widget used in the form or NULL if default.

File

src/Controller/ExifSettingsController.php, line 548

Class

ExifSettingsController
Class ExifSettingsController manage action of settings pages.

Namespace

Drupal\exif\Controller

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,
  ] : [];
  $this
    ->entity_get_form_display($this->entityTypeId, $this->bundle, 'default')
    ->setComponent($field_name, $options)
    ->save();
}