public function FieldInheritanceFactory::__construct in Field Inheritance 8
Same name and namespace in other branches
- 2.0.x src/FieldInheritanceFactory.php \Drupal\field_inheritance\FieldInheritanceFactory::__construct()
Constructs a FieldInheritanceFactory object.
Parameters
\Drupal\Core\Field\BaseFieldDefinition $definition: The data definition.
string $name: (optional) The name of the created property, or NULL if it is the root of a typed data tree. Defaults to NULL.
\Drupal\Core\TypedData\TypedDataInterface $parent: (optional) The parent object of the data property, or NULL if it is the root of a typed data tree. Defaults to NULL.
Overrides TypedData::__construct
See also
\Drupal\Core\TypedData\TypedDataManager::create()
File
- src/
FieldInheritanceFactory.php, line 31
Class
- FieldInheritanceFactory
- The FieldInheritanceFactory class.
Namespace
Drupal\field_inheritanceCode
public function __construct(BaseFieldDefinition $definition, $name = NULL, TypedDataInterface $parent = NULL) {
parent::__construct($definition, $name, $parent);
if ($this
->getSetting('plugin') === NULL) {
throw new \InvalidArgumentException("The definition's 'plugin' key has to specify the plugin to use to inherit data.");
}
if ($this
->getSetting('method') === NULL) {
throw new \InvalidArgumentException("The definition's 'method' key has to specify the method to use to inherit data. Valid options are inherit, prepend, replace, and append.");
}
if ($this
->getSetting('source entity type') === NULL) {
throw new \InvalidArgumentException("The definition's 'source entity type' key has to specify the entity type from which to inherit data.");
}
if ($this
->getSetting('source entity bundle') === NULL) {
throw new \InvalidArgumentException("The definition's 'source entity bundle' key has to specify the entity bundle from which to inherit data.");
}
if ($this
->getSetting('source field') === NULL) {
throw new \InvalidArgumentException("The definition's 'source field' key has to specify the field from which to inherit data.");
}
}