You are here

public function NifProcessed::__construct in Field NIF 8

Constructs a TypedData object given its definition and context.

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $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/NifProcessed.php, line 27

Class

NifProcessed
A computed property for processing NIF/CIF/NIE documents.

Namespace

Drupal\field_nif

Code

public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
  parent::__construct($definition, $name, $parent);
  if ($definition
    ->getSetting('document source') === NULL) {
    throw new \InvalidArgumentException("The definition's 'document source' key has to specify the name of the properties to be processed.");
  }
}