com\setasign\SetaSite\BlockManager
SimpleBlockManager
File: /SetaSite/src/BlockManager/SimpleBlockManager.php
Class hierarchy
Summary
Methods
- __construct()
- addBlock()
- exportBlocks()
- getBlock()
- getBlockData()
- getBlockOverview()
- getBlockRenderOrder()
- getPlaceholder()
- getPlaceholderBlocks()
- hasBlockName()
- importBlocks()
- isValid()
- moveBlock()
- removeBlock()
- removeBlocksFromAllPlaceholders()
- removeBlocksFromPlaceholder()
- render()
- renderBlock()
- reorder()
- setBlockData()
- setBlockName()
- setData()
- setReadOnly()
- setRenderOrder()
- setVisibility()
- sortBlockOverview()
Properties
$blockInstances
$blockParent
$factory
$pageSettings
Methods
__construct()
\com\setasign\SetaSite\Page\PageSettings $pageSettings,
\com\setasign\SetaSite\Block\BlockParent\BlockParentInterface $blockParent
Parameters
- $factory : \com\setasign\SetaSite\Block\BlockFactory
- $pageSettings : \com\setasign\SetaSite\Page\PageSettings
- $blockParent : \com\setasign\SetaSite\Block\BlockParent\BlockParentInterface
addBlock()
string $placeholder,
string $blockName,
int $renderOrder = 0,
bool $visibility = true,
?string $beforeBlockName = null
Adds a block to a specific placeholder with a unique blockName(for this page).
Parameters
- $block : array{type: string, data: array}
- $placeholder : string
- $blockName : string
- $renderOrder : int
- $visibility : bool
- $beforeBlockName : ?string
Exceptions
Throws UnknownBlockException
Throws \InvalidArgumentException
getBlock()
Returns the block object of $blockName
Parameters
- $blockName : string
Exceptions
Throws UnknownBlockException
getBlockData()
Returns an array with the relevant data for $blockName
Parameters
- $blockName : string
Exceptions
Throws UnknownBlockException
getBlockOverview()
You need to use setPlaceholders before you use this method.
Parameters
- $placeholders : array
getPlaceholder()
Returns the placeholder of the block
Parameters
- $blockName : string
Exceptions
Throws UnknownBlockException
getPlaceholderBlocks()
Returns the block names of all blocks in the given placeholder.
Parameters
- $placeholder : string
hasBlockName()
Checks whether the blockname exist.
Parameters
- $name : string
Name of the block.
- $placeholder : ?string
Check whether the blockname exists in the placeholder.
importBlocks()
isValid()
moveBlock()
string $targetPlaceholder,
?string $beforeBlockName = null
Moves the block to the target placeholder before a block.
If $beforeBlockName is null, the block will be moved to the last position.
Parameters
- $blockName : string
- $targetPlaceholder : string
- $beforeBlockName : ?string
Exceptions
Throws UnknownBlockException
removeBlock()
removeBlocksFromAllPlaceholders()
Removes all blocks from all placeholders. It doesn't matter whether these placeholders exist in the template.
removeBlocksFromPlaceholder()
Removes all blocks from a placeholder.
Parameters
- $placeholder : string
render()
Parameters
- $placeholders : array
- $params : array
Exceptions
renderBlock()
Parameters
- $blockName : string
- $params : array
Exceptions
Throws \com\setasign\SetaSite\Exception
Throws \com\setasign\SetaSite\Block\ForceResponseException
Throws \com\setasign\SetaSite\HttpErrorException
Throws UnknownBlockException
reorder()
setBlockData()
Sets the blockData.
Parameters
- $blockName : string
- $blockData : array
Exceptions
Throws UnknownBlockException
setBlockName()
Sets the blockname
Parameters
- $oldName : string
- $newName : string
Exceptions
Throws UnknownBlockException If $oldName is unknown or $newName is already existing.
setData()
Sets all data
Only for internal use!
Parameters
- $data : array[]
Exceptions
Throws \InvalidArgumentException
setRenderOrder()
Sets the render order.
Parameters
- $blockName : string
- $renderOrder : int
Exceptions
Throws UnknownBlockException
setVisibility()
Sets the visibility.
Parameters
- $blockName : string
- $visible : bool
Exceptions
Throws UnknownBlockException
