A class that manages the storage of CmsLayoutTemplate objects in the database.
This class also supports caching, and sending hooks at various levels
| since | 2.3 |
|---|---|
| package |
CMS |
| license |
GPL |
| author |
Robert Campbell |
__construct(\CMSMS\Database\Connection $db, \cms_cache_driver $driver, \CMSMS\hook_manager $hook_manager, \cms_config $config)
\CMSMS\Database\Connection $dbThe database
\cms_cache_driver $driverThe Cache driver
\CMSMS\hook_manager $hook_managerThe hook manager
\cms_config $configtemplate_name_to_id(string $name) : integer|null
This method uses a cached mapping of template names to id. If the item does not exist in the cache, then the cache item is built from the database.
string $nameThe template name
integer|null
get_default_template_by_type(integer $type_id) : integer|null
This method uses a cache that is built from the database if necessary.
integer $type_id integer|null
The default template id, if any.
generate_unique_template_name(string $prototype, string $prefix = null) : string
string $prototypeThe input prototype
string $prefixA prefix to apply to all output
string
validate_template(\CmsLayoutTemplate $tpl)
_insert_template(\CmsLayoutTemplate $tpl) : \CmsLayoutTemplate
save_template(\CmsLayoutTemplate $tpl)
This method takes an existing template object and either updates it into the database, or inserts it.
\CmsLayoutTemplate $tplThe template object.
delete_template(\CmsLayoutTemplate $tpl)
This method removes a template object from the database and any caches. it does not modify the template object, so care must be taken with the id.
\CmsLayoutTemplate $tplload_template(mixed $a) : \CmsLayoutTemplate|null
load_bulk_templates(array $list) : array<mixed,\CmsLayoutTemplate>
load_templates_by_type(\CmsLayoutTemplateType $type) : array<mixed,\CmsLayoutTemplate>
get_owned_templates(mixed $a) : array<mixed,\CmsLayoutTemplate>
mixed $aEither the integer uid or the username of a user.
array<mixed,\CmsLayoutTemplate>
get_editable_templates(mixed $a)
mixed $aEither the integer uid or a username
load_all_templates_by_type(\CmsLayoutTemplateType $type) : array<mixed,\CmsLayoutTemplate>|null
load_default_template_by_type(mixed $t)
mixed $tA type name, a type id, or a CmsLayoutTemplateType object
db :
cache_driver :
hook_manager :
config :