BlockRepo
Load sections and blocks. Manage, filtred.
Table of Contents
Constants
- BLOCKS_DIR = 'blocks'
- Dir of repository of blocks.
- FAVOURITE_BLOCKS_LIMIT = 5000
- Maximum allowed number of favorite blocks
- FAVOURITE_BLOCKS_LIMIT_WITH_PREVIEW = 1000
- Maximum allowed number of favorite blocks with preview image
- FILTER_DEFAULTS = 'default'
- Repo can be filtered by different ways. Filters can be enabled (by default) or disabled, see methods disableFilter and enableFilter.
- FILTER_SKIP_COMMON_BLOCKS = 'skip_common_blocks'
- FILTER_SKIP_HIDDEN_BLOCKS = 'skip_hidden_blocks'
- FILTER_SKIP_SYSTEM_BLOCKS = 'skip_system_blocks'
- NEW_BLOCK_LT = 1209600
- Life time for mark new block.
Methods
- __construct() : mixed
- clearCache() : $this
- disableFilter() : $this
- Deactivate some filter for getRepository result
- enableFilter() : $this
- Activate some filter for getRepository result
- getGeneralPaths() : array<string|int, mixed>|null
- Gets general paths, where blocks can be found.
- getNamespaces() : array<string|int, mixed>
- Gets all available namespaces.
- getRepository() : array<string|int, mixed>
- Get blocks from repository.
- isBlockInRepo() : bool
- Check is block in filtered repo
- isFilterActive() : bool
- Check is filter active
- setSiteType() : BlockRepo
- Force set site type if it does not match the landing site type
Constants
BLOCKS_DIR
Dir of repository of blocks.
public
mixed
BLOCKS_DIR
= 'blocks'
FAVOURITE_BLOCKS_LIMIT
Maximum allowed number of favorite blocks
public
mixed
FAVOURITE_BLOCKS_LIMIT
= 5000
FAVOURITE_BLOCKS_LIMIT_WITH_PREVIEW
Maximum allowed number of favorite blocks with preview image
public
mixed
FAVOURITE_BLOCKS_LIMIT_WITH_PREVIEW
= 1000
FILTER_DEFAULTS
Repo can be filtered by different ways. Filters can be enabled (by default) or disabled, see methods disableFilter and enableFilter.
public
mixed
FILTER_DEFAULTS
= 'default'
Filters will be apply to getRepository() result
FILTER_SKIP_COMMON_BLOCKS
public
mixed
FILTER_SKIP_COMMON_BLOCKS
= 'skip_common_blocks'
FILTER_SKIP_HIDDEN_BLOCKS
public
mixed
FILTER_SKIP_HIDDEN_BLOCKS
= 'skip_hidden_blocks'
FILTER_SKIP_SYSTEM_BLOCKS
public
mixed
FILTER_SKIP_SYSTEM_BLOCKS
= 'skip_system_blocks'
NEW_BLOCK_LT
Life time for mark new block.
public
mixed
NEW_BLOCK_LT
= 1209600
Methods
__construct()
public
__construct() : mixed
clearCache()
public
clearCache() : $this
Return values
$thisdisableFilter()
Deactivate some filter for getRepository result
public
disableFilter(string $filter) : $this
Parameters
- $filter : string
-
one of available filters (self::AVAILABLE_FILTERS)
Return values
$thisenableFilter()
Activate some filter for getRepository result
public
enableFilter(string $filter) : $this
Parameters
- $filter : string
-
- one of available filters (self::AVAILABLE_FILTERS)
Return values
$thisgetGeneralPaths()
Gets general paths, where blocks can be found.
public
static getGeneralPaths() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetNamespaces()
Gets all available namespaces.
public
static getNamespaces() : array<string|int, mixed>
Return values
array<string|int, mixed>getRepository()
Get blocks from repository.
public
getRepository() : array<string|int, mixed>
Return values
array<string|int, mixed>isBlockInRepo()
Check is block in filtered repo
public
isBlockInRepo(string $code) : bool
Parameters
- $code : string
Return values
boolisFilterActive()
Check is filter active
public
isFilterActive(string $filter) : bool
Parameters
- $filter : string
-
one of available filters (self::AVAILABLE_FILTERS)
Return values
boolsetSiteType()
Force set site type if it does not match the landing site type
public
setSiteType(string $type) : BlockRepo
Parameters
- $type : string