Problem/Motivation

On a node, i have an entity reference field referencing other nodes. An error is triggered by schema_item_list_item_list_element metatag if only one node is referenced.

Steps to reproduce

- Create a node type with an entity reference field referencing some other nodes.
- Configure metatags for this node type, using [node:field_other_nodes] token for schema_item_list_item_list_element
- Add a new content of this type with multiple nodes referenced in field_other_nodes field : it works !
- Add a content of this type with only one node referenced in field_other_nodes :
Error: Call to a member function initDisplay() on null in Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\ItemListElement->getItems() (line 128 of modules/contrib/schema_metatag/src/Plugin/schema_metatag/PropertyType/ItemListElement.php).

Proposed resolution

What happens is that the following condition should be reversed. A string that is not a view/display should not contain ':'.

// A string that is not a view/display.
    elseif (strpos(':', $input_value) !== FALSE) {
      return $input_value;
    }

Remaining tasks

- reverse the second condition on itemListElement->getItems method.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

olivier.br created an issue. See original summary.

olivier.br’s picture

Issue summary: View changes

olivier.br changed the visibility of the branch 8.x-2.x to hidden.

olivier.br’s picture

Status: Active » Needs review