Custom twig functions and filters

Functions

Frontend

  • getnavigation(string $type = 'page', int $parentId = 0, int $depth = null, string $excludeIds-splitted-by-dash = null, string $template = 'Core/Layout/Templates/Navigation.html.twig'): returns the html for the navigation
  • getsubnavigation(string $type = 'page', int $pageId = 0, int $startDepth = 1, int $endDepth = null, string $excludeIds-splitted-by-dash = null, string $template = 'Core/Layout/Templates/Navigation.html.twig'): returns the html for the subnavigation
  • media_library_widget(string $mediaWidgetAction, string $mediaGroupId, string $title = null, string $module = null): used to parse a widget of the media library in the template.
  • parsewidget(string $module, string $action, string $id = null): used to parse a widget of a module in the template
  • geturl(int $pageId, string $language = null): returns the url of a page by id and language
  • geturlforextraid(int $extraId, string $language = null): returns the url of a page by the id of a module action and language
  • geturlforblock(string $module, string $action = null, string $language = null, array $data = null): returns the url of a page by the module and action name, and optionally the language and the extra data

Backend and Frontend

  • include_once(string $template): extension to the twig function include that makes sure the template is only loaded once.
  • is_included(string $template): checks if the template was already included before with the include_once function
  • set_included(string $template, bool $isIncluded = true): sets the included status of a template of the include_once function, this can be used to reset the status as well
  • showbool(string|bool $status, bool $reverse = false): shows a checkbox to indicate the boolean value of the variable, also works with Y,y,1,N,n and 0