Prevent some more errors and warnings

This commit is contained in:
Keegan Rankin 2023-08-30 12:26:39 -07:00
parent 38d862a152
commit b901244d56

View file

@ -19,7 +19,7 @@ function agarica_preprocess_node(&$variables) {
$allowed_regions = ['secondary_menu'];
agarica_add_regions_to_node($allowed_regions, $variables);
}
$field_body_paragraph = $variables['elements']['field_body_paragraph'];
$field_body_paragraph = $variables['elements']['field_body_paragraph'] ?? NULL;
if (isset($field_body_paragraph)) {
$max_key = max(array_map('intval', array_keys($field_body_paragraph)));
for ($i = 0; $i <= $max_key; $i++) {
@ -106,7 +106,7 @@ function agarica_languague_switch_link() {
unset($links[$current_language]);
// Check if the current path display an entity.
$entity = FALSE;
$entity = [];
foreach (\Drupal::routeMatch()->getParameters() as $param) {
if ($param instanceof EntityInterface) {
$entity[] = $param;