FrontMatter
final class FrontMatter (View source)
| internal | This front matter extractor only supports help topic discovery and is not part of the public API. |
Extracts Front Matter from the beginning of a source.
Constants
| FRONT_MATTER_SEPARATOR |
The separator used to indicate front matter data. |
| FRONT_MATTER_REGEXP |
The regular expression used to extract the YAML front matter content. |
Properties
| protected array | $parsed | The parsed source. |
|
| protected string | $serializer | A serializer class. |
|
| protected string | $source | The source. |
Methods
__construct(string $source, string $serializer = '\\Drupal\\Component\\Serialization\\Yaml')
FrontMatter constructor.
static FrontMatter
load(string $source, string $serializer = '\\Drupal\\Component\\Serialization\\Yaml')
Creates a new FrontMatter instance.
string
getCode()
Retrieves the extracted source code.
array
getData()
Retrieves the extracted front matter data.
int
getLine()
Retrieves the line where the source code starts, after any data.
Details
__construct(string $source, string $serializer = '\\Drupal\\Component\\Serialization\\Yaml')
FrontMatter constructor.
static FrontMatter
load(string $source, string $serializer = '\\Drupal\\Component\\Serialization\\Yaml')
Creates a new FrontMatter instance.
string
getCode()
Retrieves the extracted source code.
array
getData()
Retrieves the extracted front matter data.
int
getLine()
Retrieves the line where the source code starts, after any data.