#016265: Add ability to override classes providing template operators (with patch)

Description:

Currently it's not possible to override classes providing template operators because the template engine does not rely on the autoload system, it does an include_once with the path to the classes defined in the declaration of the operator instead.
The attached patch fixes this behaviour to use the autload system by default. If the class cannot be loaded by the autoload system, eZ Publish will try to include the class using the path if it is defined.

btw, there's a small issue on the name of the class providing i18n and x18n operators. The class is defined as "eZi18nOperator", but the operator definition uses "eZI18nOperator" (notice the capital I instead of the i). The patch fixes the declaration the operator as well, but perhaps the class definition should changed ?


Environment:

Operating System:
PHP Version: (please be specific, like '4.4.3' or '5.1.5')
Database and version:
Browser (and version):


- Attachments
patch_override_operator.diff (25 kb)
[Download] [Permanent Link]

- Comments

Should set second parameter on class_exists here to false (to not trigger autloading):


+ if ( !class_exists( $functionDefinition['class'] )
+ && isset( $functionDefinition['script'] ) )

->

+ if ( !class_exists( $functionDefinition['class'], false )
+ && isset( $functionDefinition['script'] ) )

#264882 by André R. on February 25th, 2010 [Permanent Link]
- Attachments: » 016265_override_template operators.diff (same patch w/o triggiering autoload when including file x2)

I think you're right if you want to keep precedence of 'script' parameter
over the autoload system. (I didn't know that you can put a second
parameter to class_exists() btw)

#264892 by Damien Pobel on February 25th, 2010 [Permanent Link]

Implemented in
trunk (4.4.0alpha1) rev. 25248

#265896 by André R. on May 4th, 2010 [Permanent Link]

- History
Properties
Type Enhancement
Priority Medium
Components Misc
Template language
Affects 4.3.0alpha1
4.3.0 - 4.3.0release
4.4.0alpha1
Fix Version 4.4.0alpha2
Reporter Damien Pobel
Responsible André R.
Status 0 Closed
Resolution Implemented
Created February 25th, 2010
Updated July 29th, 2010
Resolved May 4th, 2010
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #019127
  DB Deadlocks on ezcontentobject_tree when updating subnode