Chris@0: config = $config; Chris@18: $this->entityTypeManager = $entity_type_manager; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { Chris@0: return new static( Chris@0: $entity_type, Chris@18: $container->get('entity.repository'), Chris@0: $container->get('language_manager'), Chris@18: $container->get('config.factory')->get('aggregator.settings'), Chris@18: $container->get('theme.registry'), Chris@18: $container->get('entity_display.repository'), Chris@18: $container->get('entity_type.manager') Chris@0: ); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function buildComponents(array &$build, array $entities, array $displays, $view_mode) { Chris@0: parent::buildComponents($build, $entities, $displays, $view_mode); Chris@0: Chris@0: foreach ($entities as $id => $entity) { Chris@0: $bundle = $entity->bundle(); Chris@0: $display = $displays[$bundle]; Chris@0: Chris@0: if ($display->getComponent('items')) { Chris@0: // When in summary view mode, respect the list_max setting. Chris@0: $limit = $view_mode == 'summary' ? $this->config->get('source.list_max') : 20; Chris@0: // Retrieve the items attached to this feed. Chris@18: $items = $this->entityTypeManager Chris@0: ->getStorage('aggregator_item') Chris@0: ->loadByFeed($entity->id(), $limit); Chris@0: Chris@18: $build[$id]['items'] = $this->entityTypeManager Chris@0: ->getViewBuilder('aggregator_item') Chris@0: ->viewMultiple($items, $view_mode, $entity->language()->getId()); Chris@0: Chris@0: if ($view_mode == 'full') { Chris@0: // Also add the pager. Chris@0: $build[$id]['pager'] = ['#type' => 'pager']; Chris@0: } Chris@0: } Chris@0: Chris@0: if ($display->getComponent('description')) { Chris@0: $build[$id]['description'] = [ Chris@0: '#markup' => $entity->getDescription(), Chris@0: '#allowed_tags' => _aggregator_allowed_tags(), Chris@0: '#prefix' => '