You are here

public function GeofieldMapAjaxPopupController::popupBuild in Geofield Map 8.2

Geofield Map 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 'GeofieldMapAjaxPopupController::popupBuild'
geofield_map.routing.yml in ./geofield_map.routing.yml
geofield_map.routing.yml

File

src/Controller/GeofieldMapAjaxPopupController.php, line 82

Class

GeofieldMapAjaxPopupController
Default controller for the leaflet_views_ajax_popup module.

Namespace

Drupal\geofield_map\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;
}