You are here

public function PropertyTypeBase::getTree in Schema.org Metatag 8.2

Get some or all of the object tree as options for @type.

Parameters

mixed $parent: Null or Array of the top level Schema.org object(s) used by this class, the objects that should be displayed as options for the @type property.

int $depth: Goes with the above value, the depth used for the above parent(s) to create the desired array of @type values.

Return value

array A hierarchical array of the object names for this class.

Overrides PropertyTypeInterface::getTree

See also

\Drupal\schema_metatag\SchemaMetatagClient::getTree();

File

src/Plugin/schema_metatag/PropertyTypeBase.php, line 148

Class

PropertyTypeBase
Base class for Property type plugins.

Namespace

Drupal\schema_metatag\Plugin\schema_metatag

Code

public function getTree($parent, $depth) {
  $tree = [];
  foreach ((array) $parent as $item) {
    $tree = array_merge($this->schemaMetatagClient
      ->getTree($item, $depth), $tree);
  }
  return $tree;
}