FrontMatter
class FrontMatter (View source)
Component for parsing front matter from a source.
This component allows for an easy and convenient way to parse
Constants
| SEPARATOR |
The separator used to indicate front matter data. |
| REGEXP |
The regular expression used to extract the YAML front matter content. |
Properties
| protected array | $parsed | The parsed source. |
|
| protected string | $serializer | A serializer. |
|
| protected string | $source | The source. |
Methods
FrontMatter constructor.
Creates a new FrontMatter instance.
Parses the source.
Retrieves the extracted source content.
Retrieves the extracted front matter data.
Retrieves the line where the source content starts, after any data.
Details
__construct(string $source, string $serializer = '\\Drupal\\Component\\Serialization\\Yaml')
FrontMatter constructor.
static FrontMatter
create(string $source, string $serializer = '\\Drupal\\Component\\Serialization\\Yaml')
Creates a new FrontMatter instance.
protected array
parse()
Parses the source.
string
getContent()
Retrieves the extracted source content.
array
getData()
Retrieves the extracted front matter data.
int
getLine()
Retrieves the line where the source content starts, after any data.