VirtualPages extends AbstractGenerator implements GeneratorInterface
VirtualPages class. This class is responsible for generating virtual pages based on the configuration provided. It extends the AbstractGenerator and implements the GeneratorInterface. It collects pages from the configuration under the 'pages.virtual' key and creates Page objects for each virtual page defined in the configuration. Each page can have its own frontmatter, and the generator ensures that the pages are created with the correct path and language settings. If a page is marked as unpublished or does not have a path defined, it will be skipped. If a page already exists with the same ID, it will also be skipped. The generated pages are added to the collection of generated pages for further processing.
Table of Contents
Interfaces
- GeneratorInterface
- Generator interface.
Properties
- $builder : Builder
- $config : Config
- $configKey : mixed
- $generatedPages : Collection
- $config : Config
Methods
- __construct() : mixed
- Gives the Builder to the object.
- generate() : void
- Creates pages and adds it to collection.
- runGenerate() : Collection
- Run the `generate` method of the generator and returns pages.
- collectPagesFromConfig() : array<string|int, mixed>|null
- Collects virtual pages configuration.
Properties
$builder
protected
Builder
$builder
$config
protected
Config
$config
$configKey
protected
mixed
$configKey
= 'pages.virtual'
$generatedPages
protected
Collection
$generatedPages
Methods
__construct()
Gives the Builder to the object.
public
__construct(Builder $builder) : mixed
Parameters
- $builder : Builder
generate()
Creates pages and adds it to collection.
public
generate() : void
runGenerate()
Run the `generate` method of the generator and returns pages.
public
runGenerate() : Collection
Return values
CollectioncollectPagesFromConfig()
Collects virtual pages configuration.
private
collectPagesFromConfig(string $configKey) : array<string|int, mixed>|null
Parameters
- $configKey : string