You are here

protected static function ItemListElement::getEntityFromRow in Schema.org Metatag 8.2

Tries to retrieve an entity from a Views row.

Parameters

object $row: The Views row.

Return value

\Drupal\Core\Entity\EntityInterface|null The entity or NULL.

1 call to ItemListElement::getEntityFromRow()
ItemListElement::getItems in src/Plugin/schema_metatag/PropertyType/ItemListElement.php

File

src/Plugin/schema_metatag/PropertyType/ItemListElement.php, line 183

Class

ItemListElement
Provides a plugin for the 'ItemListElement' Schema.org property type.

Namespace

Drupal\schema_metatag\Plugin\schema_metatag\PropertyType

Code

protected static function getEntityFromRow($row) {
  if (!empty($row->_entity)) {
    return $row->_entity;
  }
  if (isset($row->_object) && $row->_object instanceof EntityAdapter) {
    return $row->_object
      ->getValue();
  }
  return NULL;
}