Need help to complete a custom datatype

Need help to complete a custom datatype

Saturday 24 May 2008 10:11:18 am - 2 replies

Author Message

Kristof Coomans

Saturday 24 May 2008 10:30:21 am

Hi Sébastien

eZContentFunctions::createAndPublishObject() makes use of the fromString() method of the datatype. For a very simple example, see function fromString in kernel/classes/datatypes/ezstring/ezstringtype.php. Good luck! And don't forget to share your enhancement to this datatype ;)

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Sébastien Antoniotti

Saturday 24 May 2008 11:36:33 am

Hi Kristof,

You put me on the right way !

So here are the two methods I added to this datatype to make it compatible with eZContentFunctions::createAndPublishObject :

function storeObjectAttribute( $contentObjectAttribute )
{
	$data = $contentObjectAttribute->content();
	$data = sprintf('%04d-%02d-%02d', $data['year'], $data['month'], $data['day']) ;
	$contentObjectAttribute->setAttribute( "data_text", $data );
	return false;
}

function fromString( $contentObjectAttribute, $string )
{
	return $contentObjectAttribute->setAttribute( 'data_text', $string );
}

Many thanks !

eZ Publish Freelance
web : http://www.webaxis.fr

You must be logged in to post messages in this topic!

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