3 namespace Drupal\paragraphs;
5 use Drupal\Core\Entity\Entity\EntityViewDisplay;
6 use Drupal\Core\Entity\EntityViewBuilder;
9 * Render controller for paragraphs.
11 class ParagraphViewBuilder extends EntityViewBuilder {
16 public function buildMultiple(array $build_list) {
17 $build_list = parent::buildMultiple($build_list);
19 // Allow enabled behavior plugin to alter the rendering.
20 foreach ($build_list as $key => $value) {
21 $display = EntityViewDisplay::load('paragraph.' . $value['#paragraph']->bundle() . '.' . $value['#view_mode']) ?: EntityViewDisplay::load('paragraph.' . $value['#paragraph']->bundle() . '.default');
22 $paragraph_type = $value['#paragraph']->getParagraphType();
23 foreach ($paragraph_type->getEnabledBehaviorPlugins() as $plugin_id => $plugin_value) {
24 $plugin_value->view($build_list[$key], $value['#paragraph'], $display, $value['#view_mode']);