trait GetBlockToEditTrait (View source)

A port of \Concrete\Controller\Backend\UserInterface\Block::getBlockToEdit functionality that can be more easily included in different situations

Methods

array
getBlockToWorkWith(Page $page, string $areaHandle, $blockID)

Given a page, area handle and block ID, retrieves a block to work with. This function exists because if the area in question is global we have to retrieve a block differently and set different data on it.

Block|null
getBlockToEdit(Page $page, Area $area, string $areaHandle, $blockID)

Given a block we do things like ensure the proper version of the page for that block is loaded (and sometimes create a new version); we relate edits to pages if the block is in a stack, etc.

Details

array getBlockToWorkWith(Page $page, string $areaHandle, $blockID)

Given a page, area handle and block ID, retrieves a block to work with. This function exists because if the area in question is global we have to retrieve a block differently and set different data on it.

Parameters

Page $page
string $areaHandle
$blockID

Return Value

array

Block|null getBlockToEdit(Page $page, Area $area, string $areaHandle, $blockID)

Given a block we do things like ensure the proper version of the page for that block is loaded (and sometimes create a new version); we relate edits to pages if the block is in a stack, etc.

..

Parameters

Page $page
Area $area
string $areaHandle
$blockID

Return Value

Block|null