The value isn't correctly taken from form_state and it's empty. Everything works when saving on the Metatag admin page.

CommentFileSizeAuthor
#2 external_hreflang-3122204-2.patch602 bytessergiuteaca

Comments

sergiuteaca created an issue. See original summary.

sergiuteaca’s picture

Status: Active » Needs review
StatusFileSize
new602 bytes

The $form_state->getValue expects to be a string if the value is directly found in values, but if it's nested, it expects a multi-dimensional associative array. So the best way to do this is to use $element['#parents'] instead of $element['#name']. This will work in both node level and metatag admin level.

Status: Needs review » Needs work

The last submitted patch, 2: external_hreflang-3122204-2.patch, failed testing. View results

sergiuteaca’s picture

Status: Needs work » Needs review

Strange, the status of the Build is Successful.

Putting it to Needs Review again.

nikunjkotecha’s picture

Status: Needs review » Fixed

Thanks Sergiu for reporting the issue and also providing the fix. You are right it was developed and tested for admin page only and it's a miss.

I confirm the fix works for both the cases and I've merged it.

Status: Fixed » Closed (fixed)

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