Monday 25 January 2010 8:44:13 am
Hi there, I use an "old" datatype extension to allow my users to pick colors with a nice color picker made with YUI. http://ez.no/fr/developer/contribs/datatypes/ez_yui_color_picker Inside the eZ publication system it works very well, but I have to create new objects from an extension. So, this a shorten piece of code :
public static function nouvelleTache($vars){
// Paramètres de l'objet
$params = array();
$params['parent_node_id'] = $vars->variable("parent_node_id");
$params['class_identifier'] = 'tache';
$params['creator_id'] = 234;
$params['section_id'] = 1;
// Attributs de l'objet
$attributesData = array();
$attributesData['nom'] = $vars->variable("nom");
// ...
$attributesData['couleur'] = $vars->variable("attribut_couleur_picker");
$params['attributes'] = $attributesData;
$objet_cree = eZContentFunctions::createAndPublishObject($params);
if($objet_cree != null)
return true;
return false;
} So the problem would be at the line :
$attributesData['couleur'] = $vars->variable("attribut_couleur_picker"); Where $vars->variable("attribut_couleur_picker") correctly contains the hexa of the color (without the leading #). But when the object is created the value stills empty... It took a look at the class of the datatype (extension/ezyuicolorpicker/datatypes/ezyuicolorpicker/ezyuicolorpickertype.php) for the function who should be used. But :
- I never wrote a DataType extension
- I don't know what should be the function (I excpected something like "fromString" :) )
Could you help me with that ? Thanks, Damien
|