You are here

public function SubscriptionController::adminOverview in Commerce Recurring Framework 8

Displays the subscription type administration page.

Return value

array A render array.

1 string reference to 'SubscriptionController::adminOverview'
commerce_recurring.routing.yml in ./commerce_recurring.routing.yml
commerce_recurring.routing.yml

File

src/Controller/SubscriptionController.php, line 47

Class

SubscriptionController
Returns responses for Subscription routes.

Namespace

Drupal\commerce_recurring\Controller

Code

public function adminOverview() {
  $header = [
    $this
      ->t('Subscription type'),
    $this
      ->t('Operations'),
  ];
  $rows = [];
  $bundles = $this->entityTypeBundleInfo
    ->getBundleInfo('commerce_subscription');
  foreach ($bundles as $bundle_name => $bundle_info) {
    $route_parameters = [
      'bundle' => $bundle_name,
    ];
    $links = [
      'manage-fields' => [
        'title' => $this
          ->t('Manage fields'),
        'url' => Url::fromRoute('entity.commerce_subscription.field_ui_fields', $route_parameters),
      ],
      'manage-form-display' => [
        'title' => $this
          ->t('Manage form display'),
        'url' => Url::fromRoute('entity.entity_form_display.commerce_subscription.default', $route_parameters),
      ],
      'manage-display' => [
        'title' => $this
          ->t('Manage display'),
        'url' => Url::fromRoute('entity.entity_view_display.commerce_subscription.default', $route_parameters),
      ],
    ];
    $rows[] = [
      $bundle_info['label'],
      [
        'data' => [
          '#type' => 'operations',
          '#links' => $links,
        ],
      ],
    ];
  }
  $build['subscription_types'] = [
    '#type' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  ];
  return $build;
}