You are here

function apigee_edge_entity_extra_field_info in Apigee Edge 8

Implements hook_entity_extra_field_info().

File

./apigee_edge.module, line 342
Copyright 2018 Google Inc.

Code

function apigee_edge_entity_extra_field_info() {
  $extra = [];
  foreach (\Drupal::entityTypeManager()
    ->getDefinitions() as $definition) {
    if (in_array(AppInterface::class, class_implements($definition
      ->getOriginalClass()))) {

      // Bundles are not supported therefore both keys are the same.
      $extra[$definition
        ->id()][$definition
        ->id()]['display']['credentials'] = [
        'label' => new TranslatableMarkup('Credentials'),
        'description' => new TranslatableMarkup('Displays credentials provided by a @label', [
          '@label' => $definition
            ->getSingularLabel(),
        ]),
        // By default it should be displayed in the end of the view.
        'weight' => 100,
        'visible' => TRUE,
      ];
      $extra[$definition
        ->id()][$definition
        ->id()]['display']['warnings'] = [
        'label' => new TranslatableMarkup('Warnings'),
        'description' => new TranslatableMarkup('Displays app warnings'),
        'weight' => -100,
        'visible' => TRUE,
      ];
    }
  }
  return $extra;
}