Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion web/themes/contrib/civictheme/includes/menu.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use Drupal\Core\Url;
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings(PHPMD.StaticAccess)
* @SuppressWarnings(PHPMD.ElseExpression)
*/
function _civictheme_preprocess_menu_items(array &$items, bool $expand_all = FALSE): void {
foreach ($items as &$item) {
Expand All @@ -27,7 +28,12 @@ function _civictheme_preprocess_menu_items(array &$items, bool $expand_all = FAL
$item['is_expanded'] = $expand_all || ($item['is_expanded'] ?? FALSE);
// Initialize 'below' as an empty array if not set.
$item['below'] = $item['below'] ?? [];
$item['title'] = isset($item['title']) ? strip_tags($item['title']) : '';
if (isset($item['title'])) {
$item['title'] = is_string($item['title']) ? strip_tags($item['title']) : $item['title'];
}
else {
$item['title'] = '';
}

if (!empty($item['below'])) {
_civictheme_preprocess_menu_items($item['below'], $expand_all);
Expand Down