You are here

public function CustomFilter::getRulesTree in Custom filter 2.0.x

Same name and namespace in other branches
  1. 8 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 260

Class

CustomFilter
Defines the entity 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;
}