function FrontMatter::__construct
Same name in other branches
- 9 core/lib/Drupal/Component/FrontMatter/FrontMatter.php \Drupal\Component\FrontMatter\FrontMatter::__construct()
- 10 core/lib/Drupal/Component/FrontMatter/FrontMatter.php \Drupal\Component\FrontMatter\FrontMatter::__construct()
- 11.x core/lib/Drupal/Component/FrontMatter/FrontMatter.php \Drupal\Component\FrontMatter\FrontMatter::__construct()
FrontMatter constructor.
Parameters
string $source: A string source.
string $serializer: A class that implements \Drupal\Component\Serialization\SerializationInterface.
File
-
core/
modules/ help_topics/ src/ FrontMatter.php, line 58
Class
- FrontMatter
- Extracts Front Matter from the beginning of a source.
Namespace
Drupal\help_topicsCode
public function __construct($source, $serializer = '\\Drupal\\Component\\Serialization\\Yaml') {
assert(is_string($source), '$source must be a string');
assert(is_string($serializer), '$serializer must be a string');
if (!is_subclass_of($serializer, '\\Drupal\\Component\\Serialization\\SerializationInterface')) {
throw new \InvalidArgumentException('The $serializer parameter must reference a class that implements \\Drupal\\Component\\Serialization\\SerializationInterface.');
}
$this->serializer = $serializer;
$this->source = $source;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.