function FrontMatter::create

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Component/FrontMatter/FrontMatter.php \Drupal\Component\FrontMatter\FrontMatter::create()
  2. 11.x core/lib/Drupal/Component/FrontMatter/FrontMatter.php \Drupal\Component\FrontMatter\FrontMatter::create()

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.