function paragraphs_viewmode_entity_view_mode_alter in Paragraphs View Modes 8
Implements hook_entity_view_mode_alter().
File
- ./
paragraphs_viewmode.module, line 32 - Contains paragraph_viewmode.module.
Code
function paragraphs_viewmode_entity_view_mode_alter(&$view_mode, EntityInterface $entity, $context) {
if (!$entity instanceof ParagraphInterface) {
return;
}
$paragraph_type = $entity
->getParagraphType();
foreach ($paragraph_type
->getEnabledBehaviorPlugins() as $plugin) {
if ($plugin instanceof ParagraphsViewmodeBehaviorInterface) {
$plugin
->entityViewModeAlter($view_mode, $entity, $context);
}
}
}