protected function FieldInheritancePluginBase::validateArguments in Field Inheritance 8
Same name and namespace in other branches
- 2.0.x src/Plugin/FieldInheritance/FieldInheritancePluginBase.php \Drupal\field_inheritance\Plugin\FieldInheritance\FieldInheritancePluginBase::validateArguments()
Validate the configuration arguments of the plugin.
1 call to FieldInheritancePluginBase::validateArguments()
- FieldInheritancePluginBase::computeValue in src/
Plugin/ FieldInheritance/ FieldInheritancePluginBase.php - Compute the value of the field.
File
- src/
Plugin/ FieldInheritance/ FieldInheritancePluginBase.php, line 310
Class
- FieldInheritancePluginBase
- Abstract class FieldInheritancePluginBase.
Namespace
Drupal\field_inheritance\Plugin\FieldInheritanceCode
protected function validateArguments() {
if (empty($this
->getMethod())) {
throw new \InvalidArgumentException("The definition's 'method' key must be set to inherit data.");
}
if (empty($this
->getSourceField())) {
throw new \InvalidArgumentException("The definition's 'source field' key must be set to inherit data.");
}
$method = $this
->getMethod();
$destination_field_methods = [
'prepend',
'append',
'fallback',
];
if (array_search($method, $destination_field_methods)) {
if (empty($this
->getDestinationField())) {
throw new \InvalidArgumentException("The definition's 'destination field' key must be set to prepend, append, or fallback to series data.");
}
}
return TRUE;
}