comparison core/modules/aggregator/src/ItemViewBuilder.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\aggregator;
4
5 use Drupal\Core\Entity\EntityViewBuilder;
6
7 /**
8 * View builder handler for aggregator feed items.
9 */
10 class ItemViewBuilder extends EntityViewBuilder {
11
12 /**
13 * {@inheritdoc}
14 */
15 public function buildComponents(array &$build, array $entities, array $displays, $view_mode) {
16 parent::buildComponents($build, $entities, $displays, $view_mode);
17
18 foreach ($entities as $id => $entity) {
19 $bundle = $entity->bundle();
20 $display = $displays[$bundle];
21
22 if ($display->getComponent('description')) {
23 $build[$id]['description'] = [
24 '#markup' => $entity->getDescription(),
25 '#allowed_tags' => _aggregator_allowed_tags(),
26 '#prefix' => '<div class="item-description">',
27 '#suffix' => '</div>',
28 ];
29 }
30 }
31 }
32
33 }