How to locate the PHP code corresponding to a template operator?

I've seen this question for the datetime operator lately on Google+. This is a very common question that has an easy answer whenever you know how the eZ Publish template operators are working internally.

If you look at the tutorial on how to write a template operator in an eZ Publish extension, you'll notice that you have to declare in an array that a given set of template operators is implemented by a given PHP class. This system is valid for extensions but in fact, it's also how the stock template operators are declared. The only difference is where the eztemplateautoload.php files are located. For the stock template operators, those files are in the directories listed in site.ini/[TemplateSettings]/AutoloadPathList[] and not in the autoloads sub-directory of each extension declared in site.ini/[TemplateSettings]/ExtensionAutoloadPath[].

Given that, it's easy to find where the datetime operator is declared for instance with the following command:

$ find . -name eztemplateautoload.php -exec grep -il datetime {} \;
# looking for file named eztemplateautoload.php containing "datetime"
./lib/eztemplate/classes/eztemplateautoload.php

And by looking at this file, you can see that this template operator is implemented by the class eZTemplateLocaleOperator and the autoload file or your favorite IDE will then show you where it is located in the eZ Publish directory.

Sortie de Auto Status 0.2

Auto Status version 0.2 est sortie ! Auto Status est une extension eZ Publish capable de mettre à jour votre statut sur différents réseaux sociaux (Twitter and Identi.ca sont supportés pour le moment) de manière automatique ou semie-automatique.

Quoi de neuf ?

La version 0.1 était inutilisable depuis la suppression de l'authentification Basic par Twitter (oui je sais cette mise à jour a plus de 10 mois...). Cette nouvelle version supporte l'authentification OAuth sur Twitter et Identi.ca.

Grâce à Nicolas Pastorino, l'évènement de workflow peut être configuré pour construire l'URL de l'objet pour un siteaccess donné.

En plus, l'extension apporte un nouvel onglet dans l'interface d'administration où il est possible de voir les mises à jour de statut effectuées par le workflow ainsi que le résultat de la mise à jour. Cet onglet permet également de relancer ou de réessayer une mise à jour ayant échouée.

Cette extension est maintenant disponible en 5 langues, je te tiens à remercier les traducteurs qui ont répondu à mon appel à contribution :

Si vous voulez traduire cette extension dans votre langue il n'est pas trop tard, vous pouvez toujours m'envoyer le fichier de traduction ou devenir membre du projet.

Et après ?

Le fichier TODO contient pas mal d'améliorations possibles. Le support de Linkedin et de Facebook sont plus ou moins prévu, pour le reste (ou toute autre idée), les contributions sont les bienvenues :-) Je vais probablement migrer vers Github ce qui permettra d'avoir un bug tracker et de faciliter les contributions.

eZ Class Lists 1.2

Je viens de mettre à disposition la version 1.2 de l'extension eZ Class Lists pour eZ Publish. Cette nouvelle version corrige principalement une erreur fatale avec eZ Publish 4.5 (et les versions communautaires d'eZ Publish). Au passage, j'ai aussi amélioré l'intégration de l'extension dans le design admin2 et restauré le chargement AJAX de la liste des objets qui ne fonctionnait plus depuis un bon moment...

Pour rappel, eZ Class Lists est une extension eZ Publish qui ajoute un onglet dans l'interface d'administration et qui permet de lister les éléments par leur type (classe de contenu) au lieu de naviguer uniquement par l'arborescence.

Release of admin2++ extension version 0.2 for eZ Publish 4.4

As I said on Twitter, I started again to develop the admin2++ eZ Publish extension, and the result is the release of the version 0.2. As I previously wrote in Frontend performance enhancements with admin2++ eZ Publish extension and in GUI enhancements with admin2++ eZ Publish extension, I try to reach two goals with this extension :

  1. Improve the performance frontend of the admin interface
  2. Provide some missing GUI features and ease the use of the admin interface

The following screencast shows most of the available features of the admin2++ extension version 0.2 :

As you can see, the biggest new feature of this release is the preview available in the popup menu. Instead of loading a new page with the preview, admin2++ provides a view of the object in the front end siteaccesses without any page refresh. I also made a big work to preload as much components as possible on the login form to fill the browser's cache. With the use of the right Apache configuration, this has a great impact on the page loading time.

How to override a default eZ Publish template operator

I answered this question by email some weeks ago, it's not a good practice but sometimes it's the only solution... In fact, overriding a default eZ Publish template operator is possible since eZ Publish Fuji (4.4) with a patch I proposed in the issue #16265. It removes the include_once calls to let eZ Publish uses the autoload system. So it's now possible to override the PHP class that provides one or several template operators like any other class in the system. Here's a quick tutorial on how to override a template operator :

1. Enable the kernel override by putting the following line in the config.php file in the eZ Publish root :

define( 'EZP_AUTOLOAD_ALLOW_KERNEL_OVERRIDE', true );

2. In an extension, copy the PHP class that provides the template operator you want to override. To easily find the class, you can have a look at eztemplateautoload.php in kernel/common or the one in lib/templates

3. Make your modification in the copy of the class

4. Generate the kernel override autoload array with the following command :

php bin/php/ezpgenerateautoloads.php -o

And that's all folks ;-)

Flux RSS des billets

Flux RSS des billets

Rechercher sur pwet.fr

À retenir

Derniers commentaires

Archives

Nuage de tags

Bioutifoul photos

Quelques liens

Licence d'utilisation

Contenu sous Licence Creative Commons By-Sa

Sauf mentions spécifiques, les billets et les photos publiés sur ce site sont placés sous la licence Creative Commons by-sa.

Pour toute utilisation dépassant le cadre de cette licence, merci de me contacter par e-mail.