Section extends AbstractGenerator implements GeneratorInterface
Section generator class. This class is responsible for generating sections from the pages in the builder. It identifies sections based on the 'section' variable in each page, and creates a new page for each section. The generated pages are added to the collection of generated pages. It also handles sorting of subpages and adding navigation links (next and previous) to the section pages.
Table of Contents
Interfaces
- GeneratorInterface
- Generator interface.
Properties
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.
- sortSubPages() : Collection
- Sorts subpages.
- addNavigationLinks() : void
- Adds navigation (next and prev) to section subpages.
Properties
$builder
protected
Builder
$builder
$config
protected
Config
$config
$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
CollectionsortSubPages()
Sorts subpages.
public
static sortSubPages(Config $config, Page $page, Collection $subPages) : Collection
Parameters
- $config : Config
- $page : Page
- $subPages : Collection
Return values
CollectionaddNavigationLinks()
Adds navigation (next and prev) to section subpages.
protected
addNavigationLinks(Collection $pages[, string|null $sortBy = null ][, bool $circular = false ]) : void
Parameters
- $pages : Collection
- $sortBy : string|null = null
- $circular : bool = false