You are here

public function TextProcessed::__construct in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/text/src/TextProcessed.php \Drupal\text\TextProcessed::__construct()

Constructs a TypedData object given its definition and context.

@todo When \Drupal\Core\Config\TypedConfigManager has been fixed to use class-based definitions, type-hint $definition to DataDefinitionInterface. https://www.drupal.org/node/1928868

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

core/modules/text/src/TextProcessed.php, line 32
Contains \Drupal\text\TextProcessed.

Class

TextProcessed
A computed property for processing text with a format.

Namespace

Drupal\text

Code

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