public getChildrenByAttribute ( string $attribute, string $value, string $mode = 'equals', string $compare = 'total', boolean | integer $recursive = true ) : array | ||
$attribute | string | |
$value | string | |
$mode | string | Compare mode, "equals", "|=", "contains_regex", etc. |
$compare | string | "total"/"namespace"/"name" |
$recursive | boolean | integer | |
return | array |
function getChildrenByAttribute($attribute, $value, $mode = 'equals', $compare = 'total', $recursive = true)
{
if ($this->childCount() < 1) {
return array();
}
$mode = explode(' ', strtolower($mode));
$match = isset($mode[1]) && $mode[1] === 'not' ? 'false' : 'true';
return $this->getChildrenByMatch(array('attributes' => array($attribute => array('operator_value' => $mode[0], 'value' => $value, 'match' => $match, 'compare' => $compare))), $recursive);
}