You are here

public function CustomFilter::getRulesTree in Custom filter 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/CustomFilter.php \Drupal\customfilter\Entity\CustomFilter::getRulesTree()

Get a tree of rules.

Parameters

string $parent: The parent id of the rules which you want the tree.

Return value

array An array with all subrules(recursive) from parent rule.

File

src/Entity/CustomFilter.php, line 244

Class

CustomFilter
Defines the entify for a filter in customfilter.

Namespace

Drupal\customfilter\Entity

Code

public function getRulesTree($parent = '') {
  $rules = $this
    ->getRules($parent);
  foreach ($rules as $rule) {
    $rules[$rule['rid']]['sub'] = $this
      ->getRulesTree($rule['rid']);
  }
  return $rules;
}