class TwillBlocks (View source)

Properties

static array<string,array> $blockDirectories
static array<string,array> $repeatersDirectories
static array<string,string> $componentBlockNamespaces
static InlineRepeater> $dynamicRepeaters
static array $loadedDynamicRepeaters
static array<string,string> $manualBlocks

Methods

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

Registers a blocks directory.

void
registerDynamicRepeater(string $name, InlineRepeater $repeater)

No description

void
discoverDynamicRepeaters(Collection $collection)

No description

string
getAvailableRepeaters()

No description

void
registerComponentBlocks(string $namespace, string $path)

No description

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.

void
registerManualBlock(string $blockClass)

No description

Block|null
findByName(string $name)

No description

Block|null
findRepeaterByName(string $name)

No description

Collection
getAll()

Gets all blocks and repeaters.

Collection
getBlocks(bool $withSettingsBlocks = false)

No description

Collection
getSettingsBlocks()

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.

array
getAllCropConfigs()

Gets all the crop configs, also those of component blocks.

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 registerDynamicRepeater(string $name, InlineRepeater $repeater)

No description

Parameters

string $name
InlineRepeater $repeater

Return Value

void

void discoverDynamicRepeaters(Collection $collection)

No description

Parameters

Collection $collection

Return Value

void

string getAvailableRepeaters()

No description

Return Value

string

void registerComponentBlocks(string $namespace, string $path)

No description

Parameters

string $namespace
string $path

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

void registerManualBlock(string $blockClass)

No description

Parameters

string $blockClass

Return Value

void

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(bool $withSettingsBlocks = false)

No description

Parameters

bool $withSettingsBlocks

Return Value

Collection

Collection getSettingsBlocks()

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

array getAllCropConfigs()

Gets all the crop configs, also those of component blocks.

Return Value

array