public function TermName::validateArgument in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/Plugin/views/argument_validator/TermName.php \Drupal\taxonomy\Plugin\views\argument_validator\TermName::validateArgument()
Overrides Entity::validateArgument
File
- core/
modules/ taxonomy/ src/ Plugin/ views/ argument_validator/ TermName.php, line 68 - Contains \Drupal\taxonomy\Plugin\views\argument_validator\TermName.
Class
- TermName
- Validates whether a term name is a valid term argument.
Namespace
Drupal\taxonomy\Plugin\views\argument_validatorCode
public function validateArgument($argument) {
if ($this->options['transform']) {
$argument = str_replace('-', ' ', $argument);
}
$terms = $this->termStorage
->loadByProperties(array(
'name' => $argument,
));
if (!$terms) {
// Returned empty array no terms with the name.
return FALSE;
}
// Not knowing which term will be used if more than one is returned check
// each one.
foreach ($terms as $term) {
if (!$this
->validateEntity($term)) {
return FALSE;
}
}
return TRUE;
}