Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Preference, module, package and PDF operators

The kernel operators ezpreference, ezmodule, module_params and ezpackage and the library operator pdf - what each reads, its parameters, what it returns, which of them have side effects - with examples rendered on a…

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/help/template-operators/kernel-misc-operators.md

On this page

Preference, module, package and PDF operators

Four operators of kernel/common/ and one of lib/ezpdf/, registered in kernel/common/eztemplateautoload.php and lib/ezpdf/classes/eztemplateautoload.php (a path of [TemplateSettings] AutoloadPathList[] in site.ini).

OperatorClass and file
ezpreferenceeZKernelOperator, kernel/common/ezkerneloperator.php
ezmoduleeZModuleOperator, kernel/common/ezmoduleoperator.php
module_paramseZModuleParamsOperator, kernel/common/ezmoduleparamsoperator.php
ezpackageeZPackageOperator, kernel/common/ezpackageoperator.php
pdfeZPDF, lib/ezpdf/classes/ezpdf.php

The examples ran on the command line as the anonymous user.

Contents

  1. The operators: ezpreference, ezmodule, module_params, ezpackage, pdf

The operators

ezpreference

Generated page: ezpreference.

ParameterTypeRequiredDefault
namestringyesfalse
  • Input: none. Returns: the current user's stored preference of that name (a string), or false.

It calls eZPreferences::value( $name ) (kernel/classes/ezpreferences.php): the value comes from the session when it was stored there for the logged-in user, otherwise from the ezpreferences table. For the anonymous user it is always false, without a query. Preferences are set by the user/preferences view (the admin's "remember this" switches), not by templates. The compiler turns the call into a direct eZPreferences::value() call (preferencesTransformation()).

1 [{ezpreference( 'admin_navigation_content' )}]
2 {ezpreference( 'admin_list_limit' )|get_type}

Output:

1 []
2 boolean[false]

ezmodule

Generated page: ezmodule.

ParameterTypeRequiredDefault
uristringnofalse
  • Input: none. Returns: true when the module is in module.ini [ModuleSettings] ModuleList[] and the siteaccess allows the view, false otherwise.

It does not check the user's policies. eZModule::accessAllowed() (lib/ezutils/classes/ezmodule.php) applies the siteaccess rules of site.ini [SiteAccessRules] Rules[] and, with [ConfigurationSettings] ManagedByDeployment=enabled, the views locked for deployment. That is why setup/info is allowed below for the anonymous user: whether the user may run it is decided by the view's own policy check. Use it to hide links to views a siteaccess switches off; use fetch( 'user', 'has_access_to', ... ) for permissions.

module_params

Generated page: module_params.

  • Input: none. Parameters: none.
  • Returns: $GLOBALS['eZRequestedModuleParams'], a hash with module_name, function_name (the view) and parameters (the named view parameters) that eZModule stores when it runs a view, or null when no view ran (as on the command line, line 5 below).
1 content/view: {ezmodule( 'content/view' )|choose( 'no', 'yes' )}
2 setup/info: {ezmodule( 'setup/info' )|choose( 'no', 'yes' )}
3 user/login: {ezmodule( 'user/login' )|choose( 'no', 'yes' )}
4 nosuchmodule/view: {ezmodule( 'nosuchmodule/view' )|choose( 'no', 'yes' )}
5 module_params: {module_params()|get_type}

Output:

1 content/view: yes
2 setup/info: yes
3 user/login: yes
4 nosuchmodule/view: no
5 module_params: null

ezpackage

Generated page: ezpackage.

ParameterTypeRequiredDefault
classstringyesfalse
datastringnofalse
  • Input: an eZPackage object (from fetch( 'package', 'list' ) or fetch( 'package', 'item' )).
  • Returns: a path, depending on class:
classReturns
thumbnailthe path of the package's first file of type thumbnail, or false
filepaththe path of the file whose variable name is data; error "No filepath found" when there is none
fileitempaththe path of the file item given in data
documentpaththe path of the package document named data; error "No documentpath found" when there is none
dirpaththe package folder in its repository

Any other class is the error "Unknown package operator name". The paths are relative to the installation root.

{def $packages = fetch( 'package', 'list', hash( 'offset', 0, 'limit', 3 ) )}
{foreach $packages as $p}
{$p.name}: thumbnail={$p|ezpackage( 'thumbnail' )|wash} dir={$p|ezpackage( 'dirpath' )|wash}

{/foreach}

Output:

slash_quotes: thumbnail= dir=var/storage/packages/local/slash_quotes
ezgmaplocation_extension: thumbnail= dir=var/storage/packages/ez-systems/ezgmaplocation_extension
ezstarrating_extension: thumbnail= dir=var/storage/packages/ez-systems/ezstarrating_extension

pdf

Generated page: pdf.

ParameterTypeRequiredDefault
operationstringyesempty

Further positional parameters depend on the operation, mostly one hash of options.

eZPDF drives the PDF export (content/pdf, the pdf view templates such as design/standard/templates/node/view/pdf.tpl). Most operations only return a markup command for the PDF engine, which the template collects as text; a few act on the PDF object:

OperationsWhat they do
toc, set_font, table, header, new_line/newline, new_page/newpage, image, anchor, link, strike, page_number/pageNumber, line, footer_block, header_block, footer, frame_header, frontpage, set_margin, keyword, create_index, ul, filled_circle, rectangle, filled_rectangle, text, text_box, text_framereturn a command string such as <C:callNewLine>; defaults come from pdf.ini
createcreates the PDF object
executecreates the PDF object (size and orientation from the options or pdf.ini [PDFGeneral]) and renders the collected text into it
streamsends the PDF to the browser
closewrites the PDF to the file name given as the second parameter, through the cluster file handler

Not run on a development installation: execute, stream and close (they render a document, send output or write a file). The operations below only build command strings:

1 {pdf( 'new_line' )}
2 {pdf( 'new_page' )}
3 {pdf( 'strike', 'old price' )}
4 {pdf( 'anchor', hash( 'name', 'top' ) )}
5 {pdf( 'link', hash( 'url', 'https://exponential.earth/', 'text', 'Exponential' ) )}
6 {pdf( 'toc', hash( 'size', array( 12, 10 ), 'dots', 'true' ) )}

Output:

1 <C:callNewLine>
2 <C:callNewPage><C:callNewLine>
3 <c:strike>old price</c:strike>
4 <C:callAnchor:top:FitH:>
5 <c:alink:https%3A%2F%2Fexponential.earth%2F>Exponential</c:alink>
6 <C:callTOC:size:12,10:dots:true>

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x