Using kernel classes in custom extension/datatype

Author Message

Emil Lazaro

Thursday 18 October 2007 10:16:09 am

I am trying to create a new datatype, where I would need some simple price validation. I am new to eZPublish, so I am not sure whether I am allowed to use another datatype in my datatype, or even call some of the basic classes. I noticed while looking at the existing datatypes that ezprice for example is using the eZSimplePrice class, just not sure if this is a good practice, or even if it's possible. The alternative is to write my own function in the new class, but then this will leave it out of synch with the rest of the site.
Any advice or input would be would be useful - thanks

Damien Pobel

Thursday 18 October 2007 10:51:55 am

Hi Emil,

You can use classes, functions from eZ Publish kernel in extensions and for most types of extension you have to do that. For example, for a custom datatype, you have to define a class which should look like :

<?php
include_once( "kernel/classes/ezdatatype.php" );

class yourDatatype extends eZDatatype
{

}
?>

Remember to always include files from the root of your eZ Publish installation.

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Emil Lazaro

Thursday 18 October 2007 12:02:38 pm

Thanks,

does that apply to the classes of the core extensions and datatypes, i.e. instead of using \kernel\shop\classes/ezsimpleprice.php, can I use the class in /kernel/classes/datatypes/ezprice/ezpricetype.php ?

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 22:20:09
Script start
Timing: Jan 18 2025 22:20:09
Module start 'layout'
Timing: Jan 18 2025 22:20:09
Module start 'content'
Timing: Jan 18 2025 22:20:10
Module end 'content'
Timing: Jan 18 2025 22:20:10
Script end

Main resources:

Total runtime0.7965 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.0469152.6406
Module start 'layout' 0.00570.0026 740.687539.4922
Module start 'content' 0.00830.7867 780.1797533.3828
Module end 'content' 0.79510.0014 1,313.562512.1250
Script end 0.7964  1,325.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00290.3654160.0002
Check MTime0.00130.1592160.0001
Mysql Total
Database connection0.00110.137110.0011
Mysqli_queries0.754994.7827570.0132
Looping result0.00050.0667550.0000
Template Total0.766196.220.3830
Template load0.00180.224620.0009
Template processing0.764395.958720.3821
Template load and register function0.00030.031910.0003
states
state_id_array0.00110.134310.0011
state_identifier_array0.00090.117620.0005
Override
Cache load0.00150.1846140.0001
Sytem overhead
Fetch class attribute can translate value0.00070.094020.0004
Fetch class attribute name0.00140.176840.0004
XML
Image XML parsing0.00060.075120.0003
class_abstraction
Instantiating content class attribute0.00000.001240.0000
General
dbfile0.00080.0950160.0000
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs