Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
after upgrading from media 2.4 to media 2.6 i now get the following errors when i edit content for every image field within a paragraph:
Notice: Undefined property: ParagraphsItemEntity::$language in media_field_widget_form() (line 143 of /umich4/umich4-test/docroot/sites/default/modules/media/includes/media.fields.inc).
Notice: Undefined property: ParagraphsItemEntity::$language in media_field_widget_form() (line 144 of /umich4/umich4-test/docroot/sites/default/modules/media/includes/media.fields.inc).
i've confirmed this is not an issue in media 2.4.
thanks.
Comment | File | Size | Author |
---|---|---|---|
#4 | media_undefined_notice_2885024-4.patch | 790 bytes | joseph.olstad |
| |||
#2 | Screen Shot 2017-06-09 at 3.10.48 PM.png | 401.34 KB | marthasa |
#2 | Screen Shot 2017-06-09 at 3.07.32 PM.png | 129.05 KB | marthasa |
Comments
Comment #2
marthasa CreditAttribution: marthasa commentedmore information: issue tracks to line 141-144 in media.fields.inc
i don't think nested paragraphs supports hostEntity and we have images within nested paragraphs so there is no $host->language - which is what is throwing the error.
attached are the results of the $element['#entity']->hostEntity() and $element.
i've just added a check for $host->language before using it:
else if ($element['#entity_type'] == 'paragraphs_item' && !empty($form['#entity'])) {
$host = $element['#entity']->hostEntity();
if (isset($host->language)) {
$element['#media_parent_entity_form_langcode'] = $host->language;
$element['#media_parent_entity_source_langcode'] = $host->language;
}
}
but probably needs a default for the else case?
Comment #3
joseph.olstadwhat version of entity_translation are you using?
Comment #4
joseph.olstadComment #5
marthasa CreditAttribution: marthasa commentednot using entity_translation.
thanks for patching!!
Comment #8
joseph.olstadfixed in 7.x-2.x dev and 7.x-3.x dev
Comment #9
awolfey CreditAttribution: awolfey commentedIt looks to me like this patch and the commit have a typo.
if (isset($host->$language)) {
should be
if (isset($host->language)) {
This is line 11 of the patch in #4.
Thanks.
Comment #11
joseph.olstadit is
see ...