function opigno_learning_path_preprocess_status_messages in Opigno Learning path 8
Same name and namespace in other branches
- 3.x opigno_learning_path.module \opigno_learning_path_preprocess_status_messages()
Implements hook_preprocess_HOOK().
File
- ./
opigno_learning_path.module, line 3875 - Contains opigno_learning_path.module.
Code
function opigno_learning_path_preprocess_status_messages(&$variables) {
$is_lp_route = opigno_learning_path_is_lp_route();
// Unset message after creating new training.
if (isset($variables['message_list']['status']) && $is_lp_route) {
$status_messages =& $variables['message_list']['status'];
foreach ($status_messages as $delta => $message) {
if ($message instanceof MarkupInterface) {
// Actually message content.
$pattern = '/(?=.*Learning Path)(?=.*has been created)/';
if (preg_match($pattern, $message
->__toString())) {
unset($status_messages[$delta]);
break;
}
}
}
// Prevent empty block message appearing.
if (empty($status_messages)) {
unset($variables['message_list']['status']);
}
}
}