class TwillBlocks (View source)

Constants

DIRECTORY_TYPE_VENDOR

Properties

static array<string,string> $blockDirectories
static array<string,string> $repeatersDirectories

Methods

void
registerPackageBlocksDirectory(string $path, string $renderNamespace = null)

Registers a blocks directory.

void
registerPackageRepeatersDirectory(string $path, string $renderNamespace = null)

Registers a repeaters directory.

getBlockCollection()

Only when the block collection is actually requested we parse all the information.

Block|null
findByName(string $name)

No description

Block|null
findRepeaterByName(string $name)

No description

Collection
getAll()

Gets all blocks and repeaters.

Collection
getBlocks()

No description

Collection
getRepeaters()

No description

Collection
readBlocksFromDirectory(string $directory, string $source, string $type, string|null $renderNamespace = null)

Gets the collection of Block objects from a given directory.

Details

void registerPackageBlocksDirectory(string $path, string $renderNamespace = null)

Registers a blocks directory.

When the blockCollection is already initialized, we read the blocks and merge them in. If the blockCollection is not yet initialized, we add it to the local static so that we can process it once the collection is needed.

Parameters

string $path
string $renderNamespace

Return Value

void

void registerPackageRepeatersDirectory(string $path, string $renderNamespace = null)

Registers a repeaters directory.

When the blockCollection is already initialized, we read the repeaters and merge them in. If the blockCollection is not yet initialized, we add it to the local static so that we can process it once the collection is needed.

Parameters

string $path
string $renderNamespace

Return Value

void

BlockCollection getBlockCollection()

Only when the block collection is actually requested we parse all the information.

Return Value

BlockCollection

Block|null findByName(string $name)

No description

Parameters

string $name

Return Value

Block|null

Block|null findRepeaterByName(string $name)

No description

Parameters

string $name

Return Value

Block|null

Collection getAll()

Gets all blocks and repeaters.

Return Value

Collection

Collection getBlocks()

No description

Return Value

Collection

Collection getRepeaters()

No description

Return Value

Collection

Collection readBlocksFromDirectory(string $directory, string $source, string $type, string|null $renderNamespace = null)

Gets the collection of Block objects from a given directory.

Parameters

string $directory
string $source
string $type
string|null $renderNamespace

Return Value

Collection