public function CustomFilter::getRules in Custom filter 8
Same name and namespace in other branches
- 2.0.x src/Entity/CustomFilter.php \Drupal\customfilter\Entity\CustomFilter::getRules()
Get all rules for same parent rule.
Parameters
string $prid: The parent id of the rules which you want all the childrens.
Return value
array An array with all child rules from specified prid.
2 calls to CustomFilter::getRules()
- CustomFilter::deleteRule in src/
Entity/ CustomFilter.php - Delete a rule.
- CustomFilter::getRulesTree in src/
Entity/ CustomFilter.php - Get a tree of rules.
File
- src/
Entity/ CustomFilter.php, line 215
Class
- CustomFilter
- Defines the entify for a filter in customfilter.
Namespace
Drupal\customfilter\EntityCode
public function getRules($prid = '', $sort = FALSE) {
// If rules is not an array(is empty) return a new empty array.
if (!is_array($this->rules)) {
return array();
}
$answer = array();
foreach ($this->rules as $rule) {
if ($rule['prid'] == $prid) {
$answer[$rule['rid']] = $rule;
}
}
if ($sort) {
$this
->sortRules($answer);
}
return $answer;
}