eZ Publish 4.1 and 4.2 hidden gems

Some very useful developer functionality has been added to eZ Publish in the past two major releases (4.1 and 4.2). I have compiled a list of improvements, mainly related to fetch functions and INI settings, that eZ Publish developers could benefit from on a day-to-day basis.

eZ Publish 4.1

Fetch functions

  1. object fetch function has a new parameter remote_id [string]. This enables you to fetch an object based on its remote ID.

    For example: fetch('content', 'object', hash('remote_id', 'f5c88a2209584891056f987fd965b0ba'))

  2. node fetch function has two new parameters: language_code [string] and remote_id [string]. This enables you to fetch a node in a given language (especially useful when users are viewing a siteaccess in another language and you need to grab content or a URL in a different language) or by remote ID.

    Examples: fetch('content', 'node', hash('node_id', 66, 'language_code', 'pol-PL')); fetch('content', 'node', hash('remote_id', '1b26c0454b09bb49dfb1b9190ffd67cb' ))

  3. trash_count fetch function has a new parameter attribute_filter [mixed]. This enables you to run attribute filtering for trash items similarly to how it is done for a list_count fetch function.

    Example: fetch('content', 'trash_count', hash('attribute_filter', array(...)))

  4. trash_object_list fetch function has three new parameters: attribute_filter [mixed], sort_by [mixed], as_object [bool]. This enables attribute filtering, sorting, and fetching elements as objects, similarly to how it is done for a list fetch function.

    Example: fetch('content', 'trash_object_list', hash('attribute_filter', array(...), 'sort_by', array(), 'as_object', true()))

  5. version_list fetch function has a new parameter sorts [array]. This enables you to sort the returned versions.

    Example: fetch('content', 'version_list', hash('sorts', array(...)))

  6. related_objects fetch function has four new parameters: limit [integer], offset [integer], as_object [bool], load_data_map [bool]. This enables you to fetch an exact number of items; define an offset (useful for pagination); fetch the items as objects; and to load the data_map array.

    Example: fetch('content', 'related_objects', hash(..., 'limit', '10', offset, '0', 'as_object', true(), 'load_data_map', false()))

  7. reverse_related_objects fetch function has four new parameters: limit [integer], offset [integer], as_object [bool], load_data_map [bool]. These parameters have the same functionality as listed above for the related_objects fetch function.

    Example: fetch('content', 'reverse_related_objects', hash(..., 'limit', '10', offset, '0', 'as_object', true(), 'load_data_map', false()))

INI settings

  1. browse.ini.[AssignRole].SelectionType is set to "multiple". This means that you can assign a role to multiple users or user groups at once.
  2. content.ini.[VersionView].VersionHistoryClass: Previously, you could specify the number of object versions to keep per class, specified by the class ID. In eZ Publish 4.1.1 and higher, you also can specify the class by its identifier; for example: VersionHistoryClass[folder]=1
  3. content.ini.[link].AvailableViewModes: Here, you can define view parameter options that users can choose from in the Online Editor. This also applies to content.ini.[embed] and content.ini.[embed-inline]
  4. cronjob.ini.[CronjobPart-unlock].Scripts: A new "unlock" cronjob script has been added. This relates to the new object states system.
  5. dbschema.ini.[SchemaSettings].SchemaPaths and dbschema.ini.[SchemaSettings].SchemaHandlerClasses added support for mysqli.
  6. ezxml.ini.[HandlerSettings] block has been removed. ezxml.ini.[InputSettings].Handler is now HandlerClass and takes a PHP class name as the input handler. ezxml.ini.[InputSettings].Alias is now AliasClasses. Similar naming has been used in ezxml.ini.[OutputSettings]
  7. ezxml.ini.[TagSettings].TagPresets enables you to define different sets of tags for different levels or types of content editors when they use the Online Editor. For example, you might have a full set of tags for an administrator but a subset for specific editors.
  8. file.ini.[ClusteringSettings].NonExistantStaleCacheHandling defines what happens when no expired cache file exists (such as when content is new), and a requested cache file is already being generated. The second request can either wait for the first request to finish, or it can generate its own result to display without storing it.
  9. ldap.ini.[LDAPSettings].LDAPDebugTrace, ldap.ini.[LDAPSettings].LDAPFollowReferrals, ldap.ini.[LDAPSettings].LDAPGroupRootNodeId, ldap.ini.[LDAPSettings].LDAPGroupRootNodeId, ldap.ini.[LDAPSettings].LDAPEmailEmptyAttributeSuffix, were added, enhancing various portions of the LDAP functionality. Please see the inline descriptions in ldap.ini.
  10. mime.ini file has been added. The mapping of file extensions to MIME types was previously controlled in a kernel file.
  11. setup.ini.[ezcversion], setup.ini.[curl_extension] and setup.ini.[iconv_extension] were added as additional tests for the setup wizard.
  12. site.ini.[Session].SessionValidationIpParts, site.ini.[Session].SessionValidationForwardedIpParts, site.ini.[Session].SessionValidationUseUA were added. These settings control the different levels of session validation (for increased session security). Please see the inline descriptions in site.ini.
  13. site.ini.[URLTranslator].TranslatableSystemUrls controls whether custom URL translations should be disabled if they conflict with existing system URLs.
  14. site.ini.[SearchSettings].DelayedIndexingClassList contains a list of class identifiers to use delayed indexing with.
  15. site.ini.[UserSettings]: You can now define your own custom registration feedback types (beyond the default registration confirmation e-mail) and your own custom user verification types (also beyond the default verification e-mail). The different communication channel or method used would depend on the new class you implement.
  16. site.ini.[UserSettings].UserNameValidationRegex, site.ini.[UserSettings].UserNameValidationErrorText, site.ini.[UserSettings].DefaultUserNameValidationErrorText: These settings are used for custom validation of usernames, affecting new users and existing users when they edit their credentials.
  17. site.ini.[UserSettings].RedirectOnLogoutWithLastAccessURI controls whether or not to use the LastAccessURI session variable to decide where to redirect the user on logout.
  18. site.ini.[RegionalSettings].TranslationCheckMTime controls whether the modified time should be checked on .ts files to determine if translation cache is valid.
  19. site.ini.[ContentSettings].ViewCacheTweaks was added. This enables the granular configuration of viewcaching behaviour per node. Please see the inline description in site.ini.
  20. site.ini.[ContentSettings].CacheGenerationTimeout: If a cache file stays in generation mode for more than this value in seconds, it is considered to have timed out, and generation is taken over by the requesting process.
  21. site.ini.[OutputSettings].OutputFilterName: Here, you can define an ouput filter class, which all rendered output will be passed through.
  22. site.ini.[HTTPHeaderSettings].OnlyForAnonymous: Here, you can apply custom headers only intended for anonymous users.
  23. soap.ini.[GeneralSettings].UseDefaultAccess was added to facilitate the usage of SOAP on eZ Publish installations that host multiple sites. Please see the inline description in soap.ini.
  24. viewcache.ini.[ViewCacheSettings].KeywordNodesCacheClearLimit was added to improve cache clearing performance if there is a very heavy usage of keywords on your site and the "keyword" clear cache method is used. Please see the inline description in viewcache.ini.
  25. webdav.ini.[GeneralSettings].StartNode defines a custom start node for WebDAV operations. By default it is /site/Content (Node ID 2).
  26. wordmatch.ini was added to enable more formatting to be preserved when pasting content from Word documents.
  27. workflow.ini.[EventSettings].AvailableOperationList: More triggers have been added, specifically for a lot more content operations.

Other

  1. A new POST parameter RedirectIfDiscarded was added to content/action.

eZ Publish 4.2

Fetch functions

  1. The attribute_filter and sort_by parameters for the list and tree fetch functions now support content object IDs and node IDs. One use would be to exclude specific nodes from the fetch result.

    Example: {fetch( 'content', 'list', hash( 'parent_node_id', '2', 'attribute_filter', array( array( 'contentobject_id', 'not_in', array( '123', '345', '567' ) ) ) )}

  2. The extended attribute_filter now supports the group_by parameter for grouping fetch results.
  3. The load_data_map parameter for tree and list fetch functions is now only enabled by default if 15 nodes or less are fetched. It can still be specifically enabled or disabled per fetch.

Other

  1. New POST parameters were added when performing an ActionRemove operation to content/action: RedirectURIAfterRemove and RedirectIfCancel. This enables you to control where to redirect a user after they delete content.

Special thanks to André Rømcke for helping me to make this list, and to Peter Keung for reviewing it.

Do not hesitate to leave a comment if you feel that something important is missing from the list above.

Comments

Great !

Great job by the eZ Team !

Thank you for this list which allows me to discover and test many new features!

re: Nice but

Thanks for comment Damien, you are absolutely right. I just made one step in order to make it happen (ez.no/doc) ;)

Nice but

Hi,

This is a very nice blog post but all those new features should definitively be documented in http://ez.no/doc.

You've already blogged about that, but you can also add the validation through content edit handler.

Cheers

Appreciation?

My Amazon.com Wish List

eZ publish™ copyright © 1999-2012 eZ systems as