TemplateBased
in package
implements
ContentBlockInterface
Class TemplateBased
Tags
Interfaces, Classes, Traits and Enums
- ContentBlockInterface
- Content block interface
Table of Contents
- $pageLocator : PageLocator
- Page content
- $templateName : string
- Name of template for rendering
- __construct() : mixed
- TemplateBased constructor.
- getContext() : array<string|int, mixed>
- Return context variables used for rendering the block's template.
- setConfig() : void
- Store the configuration of the content block.
- getContextForMd() : array<string|int, mixed>
- Return context array for markdown
- getContextForPhtml() : array<string|int, mixed>
- Return context array of phtml
Properties
$pageLocator
Page content
protected
PageLocator
$pageLocator
$templateName
Name of template for rendering
protected
string
$templateName
Methods
__construct()
TemplateBased constructor.
public
__construct(PageLocator $pageLocator) : mixed
Parameters
- $pageLocator : PageLocator
-
Content page locator service
Return values
mixed —getContext()
Return context variables used for rendering the block's template.
public
getContext([string $pathPrefix = 'templates/ContentBlock/TemplateBased/' ][, string $page = null ][, string $pattern = null ]) : array<string|int, mixed>
Parameters
- $pathPrefix : string = 'templates/ContentBlock/TemplateBased/'
-
Subdirectory where the template should be located
- $page : string = null
-
Template name (defaults to config value if unset)
- $pattern : string = null
-
Filesystem pattern (see PageLocator)
Return values
array<string|int, mixed> —setConfig()
Store the configuration of the content block.
public
setConfig(string $settings) : void
Parameters
- $settings : string
-
Settings from searches.ini.
Return values
void —getContextForMd()
Return context array for markdown
protected
getContextForMd(string $relativePath, string $path) : array<string|int, mixed>
Parameters
- $relativePath : string
-
Relative path to template
- $path : string
-
Full path of template file
Tags
Return values
array<string|int, mixed> —getContextForPhtml()
Return context array of phtml
protected
getContextForPhtml(string $relativePath, string $path) : array<string|int, mixed>
Parameters
- $relativePath : string
-
Relative path to template
- $path : string
-
Full path of template file