You are here

public function CpfItem::__construct in CPF 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/CpfItem.php \Drupal\cpf\Plugin\Field\FieldType\CpfItem::__construct()

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 FieldItemBase::__construct

See also

\Drupal\Core\TypedData\TypedDataManager::create()

File

src/Plugin/Field/FieldType/CpfItem.php, line 35

Class

CpfItem
Plugin implementation of the 'cpf' field type.

Namespace

Drupal\cpf\Plugin\Field\FieldType

Code

public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
  parent::__construct($definition, $name, $parent);
  $this->cpfService = \Drupal::service('cpf');
}