Accessing the currently edited object (custom edit handler)

Author Message

Hakim Bouras

Sunday 23 August 2009 8:52:51 am

Hi,

I am trying to use the custom edit handler, using the "fetchInput" method.

I followed the instructions provided by Lukasz to install my new handler, and it is working fine, except I cannot access the data currently edited.

I write the following code to check which value I am accessing, and whatever I am using the $version or the $contentObjectAttributes parameters, I am accessing the previously saved values but not the one that are currently edited.

Does anyone get to access these values ?

Thanks,
Hakim

function fetchInput( $http, &$module, &$class, $object, &$version, $contentObjectAttributes, $editVersion, $editLanguage, $fromLanguage ) {

	$myClassID = 100;
	$myAttributeID = 500;

	if ($object->ClassID == $myClassID) {
		// Getting the attribute value using the $contentObjectAttributes parameter
		foreach ($contentObjectAttributes as $contentAttribute) {
		  if ($contentAttribute->ContentClassAttributeID == $myAttributeID) {
			$myAttr1 = $contentAttribute->content();
			eZDebug::writeNotice('My Attribute (1): '.$myAttr1, "Custom Handler");
		  }			  
		}			
		
		// Getting the attribute value using the $version parameter
		$dataMap = $version->attribute( 'data_map' );
		$myAttr2 = $dataMap['my_attribute']->content();
		eZDebug::writeNotice('My Attribute (2): '.$myAttr2, "Custom Handler");
	}
}

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 31 2025 04:22:52
Script start
Timing: Jan 31 2025 04:22:52
Module start 'layout'
Timing: Jan 31 2025 04:22:52
Module start 'content'
Timing: Jan 31 2025 04:22:52
Module end 'content'
Timing: Jan 31 2025 04:22:52
Script end

Main resources:

Total runtime0.0138 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 588.3906151.2422
Module start 'layout' 0.00530.0024 739.632836.7109
Module start 'content' 0.00770.0046 776.343890.3438
Module end 'content' 0.01230.0014 866.687529.9922
Script end 0.0137  896.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002316.9878140.0002
Check MTime0.00117.6508140.0001
Mysql Total
Database connection0.00075.017410.0007
Mysqli_queries0.002719.287030.0009
Looping result0.00000.079610.0000
Template Total0.00107.410.0010
Template load0.00085.758410.0008
Template processing0.00021.655210.0002
Override
Cache load0.00064.037510.0006
General
dbfile0.00107.536580.0001
String conversion0.00000.043340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs