You are here

public function EventTypeListBuilder::getDefaultOperations in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/Lists/EventTypeListBuilder.php \Drupal\rng\Lists\EventTypeListBuilder::getDefaultOperations()
  2. 8 src/Lists/EventTypeListBuilder.php \Drupal\rng\Lists\EventTypeListBuilder::getDefaultOperations()

Gets this list's default operations.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.

Return value

array The array structure is identical to the return value of self::getOperations().

Overrides ConfigEntityListBuilder::getDefaultOperations

File

src/Lists/EventTypeListBuilder.php, line 52

Class

EventTypeListBuilder
Builds a list of event config entities.

Namespace

Drupal\rng\Lists

Code

public function getDefaultOperations(EntityInterface $entity) {

  /** @var \Drupal\rng\Entity\EventTypeInterface $entity **/
  $operations = parent::getDefaultOperations($entity);
  if ($this->moduleHandler
    ->moduleExists('field_ui')) {
    $entity_type = \Drupal::entityTypeManager()
      ->getDefinition($entity
      ->getEventEntityTypeId());
    if ($entity_type
      ->get('field_ui_base_route')) {
      $options = [];
      if ($entity_type
        ->getBundleEntityType() !== 'bundle') {
        $options[$entity_type
          ->getBundleEntityType()] = $entity
          ->getEventBundle();
      }
      $operations['manage-fields'] = [
        'title' => t('Event setting defaults'),
        'weight' => 15,
        'url' => Url::fromRoute("entity." . $entity
          ->getEventEntityTypeId() . ".field_ui_fields", $options),
      ];
    }
  }
  return $operations;
}