You are here

public function LeafletAjaxPopupController::popupBuild in Leaflet 2.1.x

Same name and namespace in other branches
  1. 8 modules/leaflet_views/src/Controller/LeafletAjaxPopupController.php \Drupal\leaflet_views\Controller\LeafletAjaxPopupController::popupBuild()
  2. 2.0.x modules/leaflet_views/src/Controller/LeafletAjaxPopupController.php \Drupal\leaflet_views\Controller\LeafletAjaxPopupController::popupBuild()

Leaflet Ajax Popup build callback..

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity whose build to return.

string $view_mode: The view mode identifier.

string $langcode: The langcode to render the entity by.

Return value

\Symfony\Component\HttpFoundation\Response The Response to return.

1 string reference to 'LeafletAjaxPopupController::popupBuild'
leaflet_views.routing.yml in modules/leaflet_views/leaflet_views.routing.yml
modules/leaflet_views/leaflet_views.routing.yml

File

modules/leaflet_views/src/Controller/LeafletAjaxPopupController.php, line 82

Class

LeafletAjaxPopupController
Default controller for the leaflet_views_ajax_popup module.

Namespace

Drupal\leaflet_views\Controller

Code

public function popupBuild(EntityInterface $entity, $view_mode, $langcode = NULL) {
  $entity_view_builder = $this->entityManager
    ->getViewBuilder($entity
    ->getEntityTypeId());
  $build = $entity_view_builder
    ->view($entity, $view_mode, $langcode);
  $response = new AjaxResponse();
  $response
    ->addCommand(new ReplaceCommand($this
    ->getPopupIdentifierSelector($entity
    ->getEntityTypeId(), $entity
    ->id(), $view_mode, $langcode), $build));
  return $response;
}