This issue is a clone of work that had been done on Drupal 8, but not ported to Drupal 7. See: https://www.drupal.org/node/1278052.

Currently hook_field_attach_view_alter() is the most reliable way to add output to entities. Currently metatags is using it to output the metatags for an entity. Problem is we add normal render array output which causes a PHP notice (undefined index "#field_type') in rdf_field_attach_view_alter() which assumes $output is nothing but field API fields - which is an untrue assumption. This can be resolved with a simple check with isset(). This also needs to be fixed in the example code for hook_field_attach_view_alter().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nwehner’s picture

Attached is a patch with the simple isset statement.

nwehner’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: rdf_module_php_notice_isset-2356541-1.patch, failed testing.

nwehner’s picture

Status: Needs work » Needs review
FileSize
1.68 KB

Helps to update Field API, too!

Status: Needs review » Needs work

The last submitted patch, 4: rdf_module_php_notice_isset-2356541-2.patch, failed testing.

labboy0276’s picture

Version: 7.31 » 7.37
FileSize
1.74 KB

Hello,

I am reviving this issue, I started getting this lovely error:

Notice: Undefined index: #formatter in rdf_field_attach_view_alter() (line 745 of /modules/rdf/rdf.module).

This patch comes close to addressing the issue, so I tweaked it a little to fix it for this instance.

labboy0276’s picture

Status: Needs work » Needs review

Version: 7.37 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

earthday47’s picture