Extends the paragraph render array with behavior.
array &$build: A renderable array representing the paragraph. The module may add elements to $build prior to rendering. The structure of $build is a renderable array as expected by drupal_render().
\Drupal\paragraphs\Entity\Paragraph $paragraph: The paragraph.
\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display: The entity view display holding the display options configured for the entity components.
string $view_mode: The view mode the entity is rendered in.
Overrides ParagraphsBehaviorInterface::view
public function view(array &$build, Paragraph $paragraph, EntityViewDisplayInterface $display, $view_mode) {
// Everything else is done in ParagraphsGridLayoutPlugin::preprocess method.
if ($grid_layout = $paragraph
->getBehaviorSetting($this
->getPluginId(), 'layout')) {
$layouts = $this->gridLayoutDiscovery
->getLibraries($grid_layout);
if (!isset($build['#attached']['library'])) {
$build['#attached']['library'] = [];
}
$build['#attached']['library'] = array_merge($layouts, $build['#attached']['library']);
}
}