You are here

public static function FrontMatter::create in Drupal 9

Creates a new FrontMatter instance.

Parameters

string $source: A string source.

string $serializer: The name of a class that implements \Drupal\Component\Serialization\SerializationInterface.

Return value

static

3 calls to FrontMatter::create()
FrontMatterTest::testFrontMatterData in core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php
Tests the parsed data from front matter.
FrontMatterTest::testFrontMatterSerializerException in core/tests/Drupal/Tests/Component/FrontMatter/FrontMatterTest.php
Tests when a passed serializer doesn't implement the proper interface.
TwigEnvironment::compileSource in core/lib/Drupal/Core/Template/TwigEnvironment.php

File

core/lib/Drupal/Component/FrontMatter/FrontMatter.php, line 106

Class

FrontMatter
Component for parsing front matter from a source.

Namespace

Drupal\Component\FrontMatter

Code

public static function create(string $source, string $serializer = '\\Drupal\\Component\\Serialization\\Yaml') {
  return new static($source, $serializer);
}