language in workflow event

Author Message

Rainer Scharinger

Friday 06 February 2009 2:01:16 am

Hi,

I have a multi language site and I want do trigger a workflow event on 'publish after'. In this event I need the language of the currently published object.

Is there a way to get this language without parsing the URL?

Regards

Ɓukasz Serwatka

Friday 06 February 2009 3:36:30 am

Hi,

You can get that information on object level:

Quick example:

$parameters = $process->attribute( 'parameter_list' );
$object = eZContentObject::fetch( $parameters['object_id'] );

$object->attribute('current_language');

See http://ez.no/doc/ez_publish/technical_manual/4_0/reference/objects/ezcontentobject
for attribute list.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Rainer Scharinger

Tuesday 10 February 2009 7:09:48 am

Hi,

thx for the fast reply. Unfortunately is does not work.

$parameters = $process->attribute( 'parameter_list' );
$object = eZContentObject::fetch( $parameters['object_id'] );
$language = $object->attribute('current_language');

$language always contains the language of the first translation and not the language of the published translation.

Is this a bug, or is something wrong with the code?

I also have tried

$language = $object->currentLanguage;

with the same result

Regards

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 11:31:39
Script start
Timing: Jan 18 2025 11:31:39
Module start 'layout'
Timing: Jan 18 2025 11:31:39
Module start 'content'
Timing: Jan 18 2025 11:31:40
Module end 'content'
Timing: Jan 18 2025 11:31:40
Script end

Main resources:

Total runtime0.8191 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.0070 587.9141152.6250
Module start 'layout' 0.00700.0039 740.539139.4453
Module start 'content' 0.01090.8071 779.9844547.5313
Module end 'content' 0.81790.0011 1,327.515612.1641
Script end 0.8190  1,339.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3972160.0002
Check MTime0.00140.1710160.0001
Mysql Total
Database connection0.00080.100410.0008
Mysqli_queries0.759492.7202570.0133
Looping result0.00060.0763550.0000
Template Total0.781195.420.3906
Template load0.00210.260220.0011
Template processing0.779095.105320.3895
Template load and register function0.00020.018510.0002
states
state_id_array0.00130.156310.0013
state_identifier_array0.00170.202820.0008
Override
Cache load0.00180.2225270.0001
Sytem overhead
Fetch class attribute can translate value0.00060.076420.0003
Fetch class attribute name0.00150.179350.0003
XML
Image XML parsing0.00330.402920.0016
class_abstraction
Instantiating content class attribute0.00000.001960.0000
General
dbfile0.00310.3793230.0001
String conversion0.00000.001340.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs