You are here

public function MappedObjectController::listing in Salesforce Suite 8.3

List mapped objects for the entity along the current route.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: A RouteMatch object.

Return value

array Array of page elements to render.

File

modules/salesforce_mapping/src/Controller/MappedObjectController.php, line 95

Class

MappedObjectController
Returns responses for devel module routes.

Namespace

Drupal\salesforce_mapping\Controller

Code

public function listing(RouteMatchInterface $route_match) {
  $entity = $this
    ->getEntity($route_match);
  $salesforce_mapped_objects = $this
    ->getMappedObjects($entity);
  if (empty($salesforce_mapped_objects)) {
    return [
      '#markup' => $this
        ->t('No mapped objects for %label.', [
        '%label' => $entity
          ->label(),
      ]),
    ];
  }

  // Show the entity view for the mapped object.
  $builder = $this
    ->entityTypeManager()
    ->getListBuilder('salesforce_mapped_object');
  return $builder
    ->setEntityIds(array_keys($salesforce_mapped_objects))
    ->render();
}