You are here

function apigee_edge_update_8104 in Apigee Edge 8

Enable warnings field in default app view displays.

File

./apigee_edge.install, line 300
Copyright 2018 Google Inc.

Code

function apigee_edge_update_8104() {
  foreach ([
    'developer_app',
    'team_app',
  ] as $entity_type_id) {
    if (!\Drupal::entityTypeManager()
      ->getDefinition($entity_type_id, FALSE)) {
      continue;
    }

    /** @var \Drupal\Core\Entity\EntityDisplayRepository $entity_display_repository */
    $entity_display_repository = \Drupal::service('entity_display.repository');
    $entity_view_display = $entity_display_repository
      ->getViewDisplay($entity_type_id, $entity_type_id);
    if ($entity_view_display
      ->getComponent('warnings')) {
      continue;
    }
    $entity_view_display
      ->setComponent('warnings', [
      'region' => 'content',
      'weight' => -100,
    ])
      ->save();
  }
}