function opigno_learning_path_group_view in Opigno Learning path 3.x
Implements hook_ENTITY_TYPE_view().
File
- ./
opigno_learning_path.module, line 304 - Contains opigno_learning_path.module.
Code
function opigno_learning_path_group_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
if (!$entity instanceof GroupInterface || $entity
->bundle() !== 'learning_path') {
return;
}
$content = $display
->get('content');
$actions_enabled = $content['actions_dropdown'] ?? [];
if (!$actions_enabled) {
return;
}
$lp_actions_service = \Drupal::service('opigno_learning_path.group_operations');
if ($lp_actions_service instanceof LearningPathGroupOperationsLinks) {
$build['actions_dropdown'] = $lp_actions_service
->renderActionsDropdown($entity);
}
}