class BlockElementsTemplatesManager implements BasicEntityManagerInterface

Class BlockElementsTemplatesManager is injected as empire_block_elements_templates.manager service. BlockElementsTemplatesManager handles the logic for entity.

Properties

protected BlockTemplateRepository $repository
protected BlockElementsEventContainer $eventContainer

Methods

static string
getBaseViewsDir()

No description

static string
getViewsDir()

No description

__construct(BlockTemplateRepository $repository, BlockElementsEventContainer $eventContainer)

BlockTemplateManager constructor.

save(BlockTemplate $entity)

Save BlockTemplate

edit(BlockTemplate $entity)

Merge BlockTemplate

handleTemplateEdit(string $entity, string $baseName, string $content, string $contentCss, string $contentJs, null $contentScss)

Save or edit template

bool
remove(BlockTemplate $entity)

Remove single BlockTemplate

array
findAllTemplatesForTheme(string $theme, bool $loadContent = false, null|string $entityType = null)

Get all templates for specified params

findTemplateByTitle(string $title)

Get single template by title

array|string
createTemplate(string $name, string $entity)

Save template to file

bool
editTemplateContent(string $path, string $content, string $contentScss, string $contentJs)

Edit content of html, css and js files

bool|array
getTemplateContent(string $path)

Get html, css and js content

bool|string
prepareTemplateForDownload(string $mainPath)

Prepare template for download

bool
deleteTemplate(string $path)

Delete html, css and js templates based on html template path

array
getTemplatesForEntity(string $entity)

Get all templates for specified entity

mixed
getReference(int $id)

Get reference to class

Event
dispatchBlockTemplateRemoveEvent()

Dispatch event when template is removed

Details

at line 37
static string getBaseViewsDir()

Return Value

string

at line 45
static string getViewsDir()

Return Value

string

at line 55
__construct(BlockTemplateRepository $repository, BlockElementsEventContainer $eventContainer)

BlockTemplateManager constructor.

Parameters

BlockTemplateRepository $repository
BlockElementsEventContainer $eventContainer

at line 67
BlockTemplate save(BlockTemplate $entity)

Save BlockTemplate

Parameters

BlockTemplate $entity

Return Value

BlockTemplate

at line 78
BlockTemplate edit(BlockTemplate $entity)

Merge BlockTemplate

Parameters

BlockTemplate $entity

Return Value

BlockTemplate

at line 96
BlockTemplate handleTemplateEdit(string $entity, string $baseName, string $content, string $contentCss, string $contentJs, null $contentScss)

Save or edit template

Parameters

string $entity
string $baseName
string $content
string $contentCss
string $contentJs
null $contentScss

Return Value

BlockTemplate

Exceptions

NonUniqueResultException

at line 123
bool remove(BlockTemplate $entity)

Remove single BlockTemplate

Parameters

BlockTemplate $entity

Return Value

bool

at line 136
array findAllTemplatesForTheme(string $theme, bool $loadContent = false, null|string $entityType = null)

Get all templates for specified params

Parameters

string $theme
  • Name or id of theme to select
bool $loadContent
  • Defines if query should load html, js and css content
null|string $entityType
  • Type of entity

Return Value

array

at line 149
BlockTemplate|null findTemplateByTitle(string $title)

Get single template by title

Parameters

string $title

Return Value

BlockTemplate|null

Exceptions

NonUniqueResultException

at line 162
array|string createTemplate(string $name, string $entity)

Save template to file

Parameters

string $name
string $entity

Return Value

array|string

at line 235
bool editTemplateContent(string $path, string $content, string $contentScss, string $contentJs)

Edit content of html, css and js files

Parameters

string $path
string $content
string $contentScss
string $contentJs

Return Value

bool

Exceptions

NonUniqueResultException

at line 287
bool|array getTemplateContent(string $path)

Get html, css and js content

Parameters

string $path

Return Value

bool|array

at line 315
bool|string prepareTemplateForDownload(string $mainPath)

Prepare template for download

Parameters

string $mainPath

Return Value

bool|string

at line 346
bool deleteTemplate(string $path)

Delete html, css and js templates based on html template path

Parameters

string $path

Return Value

bool

at line 387
array getTemplatesForEntity(string $entity)

Get all templates for specified entity

Parameters

string $entity

Return Value

array

at line 400
mixed getReference(int $id)

Get reference to class

Parameters

int $id

Return Value

mixed

Exceptions

ORMException

at line 409
Event dispatchBlockTemplateRemoveEvent()

Dispatch event when template is removed

Return Value

Event