class Block extends ConcreteObject implements ObjectInterface (View source)

Properties

$error from  ConcreteObject
Area|null deprecated $a
protected int|null $cID

The ID of the collection containing the block.

protected string|null $arHandle

The handle of the area containing the block.

protected Collection|null $c

The collection instance containing the block.

protected int|null $issID

The custom style set ID.

protected Block|false $proxyBlock

The proxy block instance.

protected int|null $cbRelationID

The ID of the associated block.

protected int|null $bActionCID

The ID of the collection that's associated to the block actions.

protected CacheSettings|null $cacheSettings

The block cache settings.

protected int|null $cbOverrideBlockTypeCacheSettings

Override cache settings?

protected string|null $bFilename

The custom template name.

Methods

loadError($error)

No description

isError()

No description

getError()

No description

setPropertiesFromArray($arr)

No description

static 
camelcase($file)

No description

static 
uncamelcase($string)

No description

__destruct()

Destruct the class instance.

static Block|null|false
getByID(int $bID, Collection|null $c = null, Area|string|null $a = null)

Get a block instance given its ID.

static Block|null
getByName(string $blockName)

Get a block instance given its name.

static Block
populateManually(array|Iterator $blockInfo, Collection $c, Area|string|null $a)

Initialize the instance by manually specifying the data.

int|null
getBlockID()

Returns the block identifier (if available).

string
getBlockPath()

Get the absolute path of the block directory (.../blocks/block_handle).

string|null
getBlockName()

Get the block name.

setName(string $name)

Set the name of the block.

string|null
getBlockFilename()

Get the name of the custom template.

setCustomTemplate(string $template)

Set the name of the custom template.

int|null
getBlockTypeID()

Get the ID of the block type (if available).

BlockType|null
getBlockTypeObject()

Get the block type instance.

string|null
getBlockTypeHandle()

Get the block type handle.

string|null
getBlockTypeName()

Get the block type name.

int|null
getBlockUserID()

Get the ID of the user that created the block instance.

string|null
getBlockDateAdded()

Gets the date/time when block was added (in the system time zone).

string|null
getBlockDateLastModified()

Gets the date/time when block was last modified (in the system time zone).

int|null
getPackageID()

Get the ID of the package owning this block type.

string|false
getPackageHandle()

Get the handle of the package owning this block type.

int|null
getBlockCollectionID()

Get the ID of the collection containing the block.

Collection|null
getBlockCollectionObject()

Get the collection instance containing the block.

Page|null
getOriginalCollection()

Get the page instance where this block is defined (or the page where the original block is defined if this block is an alias).

Page[]
getCollectionList()

Gets a list of collections that include this block, along with area name, etc... used in the block_details.php page in the admin control panel.

setBlockCollectionObject(Collection $c)

Set the collection instance containing the block.

string|null
getAreaHandle()

Get the handle of the area containing the block.

Area|null
getBlockAreaObject()

Get the the instance of the Area containing the block.

setBlockAreaObject(Area $a)

Set the area containing the block.

int|null
getBlockDisplayOrder()

Get the block display order (if available).

moveBlockToDisplayOrderPosition(Block|null $afterBlock)

Move this block after another block (in the block page & area).

setAbsoluteBlockDisplayOrder(int $do)

Set the absolute position of this block, regardless other blocks in the same page & area.

setOriginalBlockID(int|null $originalBID)

Get the original block ID.

Block|false
getProxyBlock()

Get the proxy block instance.

setProxyBlock(Block|null $block)

Set the proxy block instance.

int|null
getBlockRelationID()

Get the ID of the associated block.

int|false
getBlockActionCollectionID()

Get the ID of the collection that's associated to the block actions (or false if not found).

setBlockActionCollectionID(int|null $bActionCID)

Set the ID of the collection that's associated to the block actions.

bool
isEditable()

Does this block have an edit user interface?

int
isActive()

Is the block active?

deactivate()

Deactivate the block.

activate()

Activate the block.

int
disableBlockVersioning()

Is the block versioning disabled?

bool|null
isAlias(Collection|null $c = null)

Check if this block instance is an alias.

bool
isAliasOfMasterCollection()

Check if this block is an alias from a page default.

int
getNumChildren()

Get the number of alias of this block.

bool
isBlockInStack()

Is this block inside a stack?

int
getCustomStyleSetID()

Get the ID of the custom style set.

getCustomStyle(bool $force = false)

Get the custom style object associated to this block.

setCustomStyleSet(StyleSet $set)

Set the block custom styles.

resetCustomStyle()

Remove the block custom styles.

getBlockCacheSettingsObject()

Get the cache settings instance.

overrideBlockTypeCacheSettings()

Override cache settings?

setCustomCacheSettings(bool $enabled, bool $enabledOnPost, bool $enabledForRegistered, int $lifetime)

Customize the cache settings, overriding the values of the block type controller.

resetCustomCacheSettings()

Reset the cache settings, so that concrete5 will use the values of the block type controller.

string|null
getBlockCachedRecord()

Get the cached record of the block instance.

bool
cacheBlockOutput()

Should the block output be cached?

bool
cacheBlockOutputOnPost()

Should the block output be cached upon POST requests?

bool
cacheBlockOutputForRegisteredUsers()

Should the block output be cached when site visitors are registered users?

int
getBlockOutputCacheLifetime()

Get the lifetime (in seconds) of the block output cache.

setBlockCachedOutput(string $content, int|null $lifetime, Area|null $area)

Set the output cache.

string|false
getBlockCachedOutput(Area|null $area)

Get the cached output of the block instance (if available and not expired).

refreshBlockOutputCache()

Mark the output cache as expired.

overrideAreaPermissions()

Area permissions are overridden?

doOverrideAreaPermissions()

Mark the block as having permissions that override the ones of the area.

revertToAreaPermissions()

Revert the permission of the object to the one of the area that contains the block.

bool
enableBlockContainer()

Is the block grid container enabled?

bool
ignorePageThemeGridFrameworkContainer()

Should the view ignore the grid container?

int
overrideBlockTypeContainerSettings()

Should this instance override the grid container settings of the block controller?

setCustomContainerSettings(bool $enableBlockContainer)

Set the custom settings related to the grid container (overriding the block type default values).

resetBlockContainerSettings()

Reset the settings related to the grid container to the block type default values.

disableBlockContainer()

Disable the original block container for the current request.

getController()

Get the block type controller.

display(string $view = 'view')

Render the block display.

inc(string $file)

Include a file (if it exists).

update(array $data)

Updates fields common to every block.

updateBlockInformation(array $data)

Update the block information, like its block filename, and block name.

bool
move(Collection $collection, Area $area)

Move the block to a new collection and/or area.

Block|false
duplicate(Collection $nc, bool $isCopyFromMasterCollectionPropagation = false)

Duplicate this block to a new collection.

alias(Collection $c)

Create an alias of the block, attached to this collection, within the CollectionVersionBlocks table.

bool|null
deleteBlock(bool $forceDelete = false)

Delete this block instance.

export(SimpleXMLElement $node, string $exportType = 'full')

Export the data associated to this block to an XML node.

Queue
queueForDefaultsAliasing(bool $addBlock, Queue $queue)

Populate the queue to be used to add/update blocks of the pages of a specific type.

Queue
queueForDefaultsUpdate(mixed $data, Queue $queue, bool $includeThisBlock = true)

Populate the queue to be used to work on the block and it aliases.

loadNewCollection(Collection $c) deprecated

No description

string
_getBlockAction() deprecated

No description

string
getBlockEditAction() deprecated

No description

string
getBlockUpdateInformationAction() deprecated

No description

string
getBlockUpdateCssAction() deprecated

No description

bool
isGlobal() deprecated

No description

getInstance() deprecated

No description

delete(bool $forceDelete = false) deprecated

No description

refreshCache() deprecated

No description

refreshCacheAll() deprecated

No description

Details

loadError($error)

No description

Parameters

$error

isError()

No description

getError()

No description

setPropertiesFromArray($arr)

No description

Parameters

$arr

static camelcase($file)

No description

Parameters

$file

static uncamelcase($string)

No description

Parameters

$string

__destruct()

Destruct the class instance.

static Block|null|false getByID(int $bID, Collection|null $c = null, Area|string|null $a = null)

Get a block instance given its ID.

Parameters

int $bID

The block ID

Collection|null $c

the collection instance containing the block

Area|string|null $a

the area containing the block (or its handle)

Return Value

Block|null|false

Return NULL if the block wasn't found; false if the block type class wasn't found; a Block instance otherwise

static Block|null getByName(string $blockName)

Get a block instance given its name.

Parameters

string $blockName

Return Value

Block|null

returns NULL if $blockName is empty; a Block instance otherwise (the getBlockID() method will return NULL if the block was not found)

static Block populateManually(array|Iterator $blockInfo, Collection $c, Area|string|null $a)

Initialize the instance by manually specifying the data.

Parameters

array|Iterator $blockInfo

A set key-value pairs used to initialize the instance

Collection $c

The collection containing the block

Area|string|null $a

the area containing the block (or its handle)

Return Value

Block

int|null getBlockID()

Returns the block identifier (if available).

Return Value

int|null

string getBlockPath()

Get the absolute path of the block directory (.../blocks/block_handle).

Return Value

string

string|null getBlockName()

Get the block name.

Return Value

string|null

setName(string $name)

Set the name of the block.

Parameters

string $name

string|null getBlockFilename()

Get the name of the custom template.

Return Value

string|null

setCustomTemplate(string $template)

Set the name of the custom template.

Parameters

string $template

int|null getBlockTypeID()

Get the ID of the block type (if available).

Return Value

int|null

BlockType|null getBlockTypeObject()

Get the block type instance.

Return Value

BlockType|null

string|null getBlockTypeHandle()

Get the block type handle.

Return Value

string|null

string|null getBlockTypeName()

Get the block type name.

Return Value

string|null

int|null getBlockUserID()

Get the ID of the user that created the block instance.

Return Value

int|null

string|null getBlockDateAdded()

Gets the date/time when block was added (in the system time zone).

Return Value

string|null

date/time formated like: 2009-01-01 00:00:00

string|null getBlockDateLastModified()

Gets the date/time when block was last modified (in the system time zone).

Return Value

string|null

date/time formated like: 2009-01-01 00:00:00

int|null getPackageID()

Get the ID of the package owning this block type.

Return Value

int|null

string|false getPackageHandle()

Get the handle of the package owning this block type.

Return Value

string|false

int|null getBlockCollectionID()

Get the ID of the collection containing the block.

Return Value

int|null

Collection|null getBlockCollectionObject()

Get the collection instance containing the block.

Return Value

Collection|null

Page|null getOriginalCollection()

Get the page instance where this block is defined (or the page where the original block is defined if this block is an alias).

Return Value

Page|null

Page[] getCollectionList()

Gets a list of collections that include this block, along with area name, etc... used in the block_details.php page in the admin control panel.

Return Value

Page[]

setBlockCollectionObject(Collection $c)

Set the collection instance containing the block.

Parameters

Collection $c

string|null getAreaHandle()

Get the handle of the area containing the block.

Return Value

string|null

Area|null getBlockAreaObject()

Get the the instance of the Area containing the block.

Return Value

Area|null

setBlockAreaObject(Area $a)

Set the area containing the block.

Parameters

Area $a

int|null getBlockDisplayOrder()

Get the block display order (if available).

Return Value

int|null

moveBlockToDisplayOrderPosition(Block|null $afterBlock)

Move this block after another block (in the block page & area).

Parameters

Block|null $afterBlock

set to NULL to move this block at the first position; Set to a Block instance to move this block after that instance

setAbsoluteBlockDisplayOrder(int $do)

Set the absolute position of this block, regardless other blocks in the same page & area.

Parameters

int $do

the new absolute position of the block (starting from 0)

setOriginalBlockID(int|null $originalBID)

Get the original block ID.

Parameters

int|null $originalBID

Block|false getProxyBlock()

Get the proxy block instance.

Return Value

Block|false

setProxyBlock(Block|null $block)

Set the proxy block instance.

Parameters

Block|null $block

int|null getBlockRelationID()

Get the ID of the associated block.

Return Value

int|null

int|false getBlockActionCollectionID()

Get the ID of the collection that's associated to the block actions (or false if not found).

Return Value

int|false

setBlockActionCollectionID(int|null $bActionCID)

Set the ID of the collection that's associated to the block actions.

Parameters

int|null $bActionCID

bool isEditable()

Does this block have an edit user interface?

Return Value

bool

int isActive()

Is the block active?

Return Value

int

0 for false, 1 for true

deactivate()

Deactivate the block.

activate()

Activate the block.

int disableBlockVersioning()

Is the block versioning disabled?

Return Value

int

0 for false, 1 for true

bool|null isAlias(Collection|null $c = null)

Check if this block instance is an alias.

Parameters

Collection|null $c

if specified, check if the block with the ID of this instance is an alias in that page (otherwise the check is done agains this specific block instance)

Return Value

bool|null

return NULL if $c is specified but there's no block with the same ID in that page

bool isAliasOfMasterCollection()

Check if this block is an alias from a page default.

Return Value

bool

int getNumChildren()

Get the number of alias of this block.

Return Value

int

bool isBlockInStack()

Is this block inside a stack?

Return Value

bool

int getCustomStyleSetID()

Get the ID of the custom style set.

Return Value

int

returns 0 or false if the block does not have custom styles

CustomStyle|null getCustomStyle(bool $force = false)

Get the custom style object associated to this block.

Parameters

bool $force

Do you want a CustomStyle instance even if the block does not have custom styles?

Return Value

CustomStyle|null

setCustomStyleSet(StyleSet $set)

Set the block custom styles.

Parameters

StyleSet $set

resetCustomStyle()

Remove the block custom styles.

CacheSettings getBlockCacheSettingsObject()

Get the cache settings instance.

Return Value

CacheSettings

overrideBlockTypeCacheSettings()

Override cache settings?

setCustomCacheSettings(bool $enabled, bool $enabledOnPost, bool $enabledForRegistered, int $lifetime)

Customize the cache settings, overriding the values of the block type controller.

Parameters

bool $enabled

Should the block output be cached?

bool $enabledOnPost

Should the block output be cached upon POST requests?

bool $enabledForRegistered

Should the block output be cached when site visitors are registered users?

int $lifetime

cache lifetime (in seconds); if empty we'll assume 5 years

resetCustomCacheSettings()

Reset the cache settings, so that concrete5 will use the values of the block type controller.

string|null getBlockCachedRecord()

Get the cached record of the block instance.

Return Value

string|null

bool cacheBlockOutput()

Should the block output be cached?

Return Value

bool

bool cacheBlockOutputOnPost()

Should the block output be cached upon POST requests?

Return Value

bool

bool cacheBlockOutputForRegisteredUsers()

Should the block output be cached when site visitors are registered users?

Return Value

bool

int getBlockOutputCacheLifetime()

Get the lifetime (in seconds) of the block output cache.

Return Value

int

setBlockCachedOutput(string $content, int|null $lifetime, Area|null $area)

Set the output cache.

Parameters

string $content

the block output to be placed in the cache

int|null $lifetime

The cache life time (in seconds). If empty we'll assume 5 years.

Area|null $area

the stack area containing the block

string|false getBlockCachedOutput(Area|null $area)

Get the cached output of the block instance (if available and not expired).

Parameters

Area|null $area

Return Value

string|false

refreshBlockOutputCache()

Mark the output cache as expired.

overrideAreaPermissions()

Area permissions are overridden?

doOverrideAreaPermissions()

Mark the block as having permissions that override the ones of the area.

Initial permissions are copied from the page/area.

revertToAreaPermissions()

Revert the permission of the object to the one of the area that contains the block.

bool enableBlockContainer()

Is the block grid container enabled?

Return Value

bool

bool ignorePageThemeGridFrameworkContainer()

Should the view ignore the grid container?

Return Value

bool

int overrideBlockTypeContainerSettings()

Should this instance override the grid container settings of the block controller?

Return Value

int

0/false: false, 1/true: true

setCustomContainerSettings(bool $enableBlockContainer)

Set the custom settings related to the grid container (overriding the block type default values).

Parameters

bool $enableBlockContainer

Is the block grid container enabled?

resetBlockContainerSettings()

Reset the settings related to the grid container to the block type default values.

disableBlockContainer()

Disable the original block container for the current request.

This is called by the scrapbook proxy block, because the scrapbook block takes care of rendering the container.

getPermissionObjectIdentifier()

getPermissionResponseClassName()

getPermissionAssignmentClassName()

getPermissionObjectKeyCategoryHandle()

BlockController getController()

Get the block type controller.

Return Value

BlockController

display(string $view = 'view')

Render the block display.

Parameters

string $view

inc(string $file)

Include a file (if it exists).

Parameters

string $file

The file name, relative to the block path (.../blocks/block_handle).

update(array $data)

Updates fields common to every block.

Parameters

array $data

the block type-specific data to be saved

updateBlockInformation(array $data)

Update the block information, like its block filename, and block name.

Parameters

array $data

Valid keys:

  • 'bName' to update the block name
  • 'bFilename' to update the block custom template

bool move(Collection $collection, Area $area)

Move the block to a new collection and/or area.

Parameters

Collection $collection
Area $area

Return Value

bool

Block|false duplicate(Collection $nc, bool $isCopyFromMasterCollectionPropagation = false)

Duplicate this block to a new collection.

Parameters

Collection $nc

The destination collection

bool $isCopyFromMasterCollectionPropagation

Return Value

Block|false

returns false if the block type can't be found; the new block instance otherwise

alias(Collection $c)

Create an alias of the block, attached to this collection, within the CollectionVersionBlocks table.

Additionally, this command grabs the permissions from the original record in the CollectionVersionBlocks table, and attaches them to the new one.

Parameters

Collection $c

The collection to add the block alias to

bool|null deleteBlock(bool $forceDelete = false)

Delete this block instance.

Parameters

bool $forceDelete

If this is an alias block, should we delete all the block instances in addition to the alias?

Return Value

bool|null

Returns false if the block is not valid

export(SimpleXMLElement $node, string $exportType = 'full')

Export the data associated to this block to an XML node.

Parameters

SimpleXMLElement $node

the parent node where we'll append the XML node to

string $exportType

set to 'full' to export cache and custom style settings too

Queue queueForDefaultsAliasing(bool $addBlock, Queue $queue)

Populate the queue to be used to add/update blocks of the pages of a specific type.

Parameters

bool $addBlock

add this block to the pages where this block does not exist? If false, we'll only update blocks that already exist

Queue $queue

The queue to add the messages too (it will be emptied before adding the new messages)

Return Value

Queue

Queue queueForDefaultsUpdate(mixed $data, Queue $queue, bool $includeThisBlock = true)

Populate the queue to be used to work on the block and it aliases.

Parameters

mixed $data

Custom data to be added to the queue messages

Queue $queue

The queue to add the messages too (it will be emptied before adding the new messages)

bool $includeThisBlock

Include this block instance in the queue?

Return Value

Queue

loadNewCollection(Collection $c) deprecated

deprecated Use the setBlockCollectionObject() method

No description

Parameters

Collection $c

string _getBlockAction() deprecated

deprecated We switched to route-based actions

No description

Return Value

string

string getBlockEditAction() deprecated

deprecated We switched to route-based actions

No description

Return Value

string

string getBlockUpdateInformationAction() deprecated

deprecated We switched to route-based actions

No description

Return Value

string

string getBlockUpdateCssAction() deprecated

deprecated We switched to route-based actions

No description

Return Value

string

bool isGlobal() deprecated

deprecated no more scrapbooks in the dashboard

No description

Return Value

bool

BlockController getInstance() deprecated

deprecated use the getController() method

No description

Return Value

BlockController

delete(bool $forceDelete = false) deprecated

deprecated use the deleteBlock() method

No description

Parameters

bool $forceDelete

refreshCache() deprecated

deprecated This method does nothing

No description

refreshCacheAll() deprecated

deprecated This method does nothing

No description