You are here

protected function PluginHierarchyTrait::buildPluginHierarchyLevel in Plugin 8.2

Helper function for self::hierarchy().

Parameters

array $parent_plugin_ids: An array with IDs of plugins that are part of the same hierarchy level.

array $child_plugin_ids: Keys are plugin IDs. Values are arrays with those plugin's child plugin IDs.

Return value

array[] The return value is identical to that of self::hierarchy().

1 call to PluginHierarchyTrait::buildPluginHierarchyLevel()
PluginHierarchyTrait::buildPluginHierarchy in src/PluginHierarchyTrait.php
Returns a hierarchical plugin representation.

File

src/PluginHierarchyTrait.php, line 59

Class

PluginHierarchyTrait
Supports handling hierarchical plugins.

Namespace

Drupal\plugin

Code

protected function buildPluginHierarchyLevel(array $parent_plugin_ids, array $child_plugin_ids) {
  $hierarchy = [];
  foreach ($parent_plugin_ids as $plugin_id) {
    $hierarchy[$plugin_id] = isset($child_plugin_ids[$plugin_id]) ? $this
      ->buildPluginHierarchyLevel($child_plugin_ids[$plugin_id], $child_plugin_ids) : [];
  }
  return $hierarchy;
}