Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mymodule_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
- if ($entity->getEntityType()->id() == 'node' && $entity->bundle() == 'example_content_type') {
- $node_id = Drupal::routeMatch()->getRawParameter('node');
- $index = 0;
- foreach($build['field_paragraph_field'] as $key => $value) {
- if (is_numeric($key) && $value['#paragraph']->bundle() == 'body') {
- $news_view = [
- '#type' => 'view',
- '#name' => 'my_news_feed',
- '#display_id' => 'block_1',
- '#arguments' => [$node_id],
- ];
- array_splice($build['field_paragraph_field'], $index + 1, 0, [$news_view]);
- }
- $index++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement