TemplateService
This service class contains functions related to templating functionality.
All public functions are available in the Twig template renderer.
Namespace
IO\Services
Type | Name | Description |
---|---|---|
|
Stores the id of the current template |
|
|
Stores data for the current template |
|
|
If true, template will be cached in the content cache (Default: true) |
|
|
If true, force the NOINDEX robots attribute for this template |
Methods
public forceNoIndex($forceNoIndex)
Setter for the $forceNoIndex property.
Type |
Name |
Description |
|
If true, force the NOINDEX robots attribute for this template. |
public isNoIndexForced():bool
Getter for the $forceNoIndex property. If true, force the NOINDEX robots attribute for this template.
public shouldBeCached():bool
Getter for the $shouldBeCached property. If true, template will be cached in the content cache
public disableCacheForTemplate()
Disable the content caching for this template
public getCurrentTemplate():string
Getter for the $currentTemplate property. Returns the id of the current template.
public setCurrentTemplate($template)
Setter for the $currentTemplate property.
Type |
Name |
Description |
|
Identifier of a template |
public isCurrentTemplate($templateToCheck):bool
Deprecated!
Use ShopUrls::is() instead |
Check if the current template is same as the parameter
Type |
Name |
Description |
|
A template id to compare against |
public isHome()
Deprecated!
Use ShopUrls::is(RouteConfig::HOME) instead |
Check if the current template is the home template
public isItem()
Deprecated!
Use ShopUrls::is(RouteConfig::ITEM) instead |
Check if the current template is the item template
public isMyAccount()
Deprecated!
Use ShopUrls::is(RouteConfig::MY_ACCOUNT) instead |
Check if the current template is the my account template
public isCheckout()
Deprecated!
Use ShopUrls::is(RouteConfig::CHECKOUT) instead |
Check if the current template is the checkout template
public isSearch()
Deprecated!
Use ShopUrls::is(RouteConfig::SEARCH) instead |
Check if the current template is the search template
public isCategory()
Deprecated!
Use ShopUrls::is(RouteConfig::CATEGORY) instead |
Check if the current template is the category template
public renderTemplate($template, $params):string
Render a twig template into a string
Type |
Name |
Description |
|
A twig template to render |
|
|
Environmental data for the twig template |
public isCheapestSorting():bool
Check if the price sorting returns the cheapest price