Notice: Undefined index: hreflang in metatag_hreflang_page_attachments_alter() (line 40 of metatag_hreflang.module)

This fixed the issue but i dont know how to write patches yet

if (strpos($element[1], 'hreflang_per_language') !== false) {
$hreflang_per_language[] = $element[0]['#attributes']['hreflang'];
}

to this :

if (strpos($element[1], 'hreflang_per_language') !== false && isset($element[0]['#attributes']['hreflang'])) {
$hreflang_per_language[] = $element[0]['#attributes']['hreflang'];
}
CommentFileSizeAuthor
#2 3229004-2.patch784 byteslarisse

Comments

Rar9 created an issue. See original summary.

larisse’s picture

Status: Active » Needs review
StatusFileSize
new784 bytes

Hi! I created a patch with the solution in described.

damienmckenna’s picture

damienmckenna’s picture

Issue summary: View changes

This definitely makes sense, but I'd love to know what scenarios lead to this happening in the first place. Rar9: could you please provide steps to recreate the problem? Thank you.

rar9’s picture

No just got this error i posted in Logs

damienmckenna’s picture

Title: Undefined index: hreflang in metatag_hreflang_page_attachments_alter() (line 40 » Undefined index: hreflang in metatag_hreflang_page_attachments_alter()
Status: Needs review » Fixed

Committed. Thank you.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.