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.