You are here

public function CustomFilter::deleteRule in Custom filter 8

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

Delete a rule.

Parameters

string $rid: The id of the rule.

File

src/Entity/CustomFilter.php, line 126

Class

CustomFilter
Defines the entify for a filter in customfilter.

Namespace

Drupal\customfilter\Entity

Code

public function deleteRule($rid) {
  $ids[] = $rid;
  $i = 0;
  while ($i < count($ids)) {
    $rules = $this
      ->getRules($ids[$i]);
    foreach ($rules as $rule) {
      $ids[] = $rule['rid'];
    }
    $i++;
  }
  foreach ($ids as $id) {
    unset($this->rules[$id]);
  }
}