Pathologic was missing because of a .git folder inside.
[yaffs-website] / web / modules / contrib / entity / src / EntityViewBuilder.php
1 <?php
2
3 namespace Drupal\entity;
4
5 use Drupal\Core\Entity\ContentEntityInterface;
6 use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
7 use Drupal\Core\Entity\EntityInterface;
8 use Drupal\Core\Entity\EntityViewBuilder as CoreEntityViewBuilder;
9
10 /**
11  * Provides a entity view builder with contextual links support
12  */
13 class EntityViewBuilder extends CoreEntityViewBuilder {
14
15   /**
16    * {@inheritdoc}
17    */
18   protected function alterBuild(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
19     $entity_type_id = $entity->getEntityTypeId();
20     if (($entity instanceof ContentEntityInterface && $entity->isDefaultRevision()) || !$entity->getEntityType()->isRevisionable()) {
21       $build['#contextual_links'][$entity_type_id] = [
22         'route_parameters' => [
23           $entity_type_id => $entity->id()
24         ],
25       ];
26     }
27     else {
28       $build['#contextual_links'][$entity_type_id . '_revision'] = [
29         'route_parameters' => [
30           $entity_type_id => $entity->id(),
31           $entity_type_id . '_revision' => $entity->getRevisionId(),
32         ],
33       ];
34     }
35   }
36
37 }