Thursday 20 August 2009 1:37:24 am - 1 reply
Benjamin Plaquevent
Thursday 20 August 2009 2:00:09 am
I solved this issue :
$url_id = eZURL::registerURL($href); $text = '<a href="' . $href . '" target="_blank">' . $link_text . '</a>'; $attributes["body"] = $this->getXML($texte); // a method returning valid eZPublish XML $param_creation = array( 'parent_node_id' => $parent_node_id, 'class_identifier' => 'breve', 'creator_id' => $creator_id, 'attributes' => $attributes); $object = eZContentFunctions::createAndPublishObject($param_creation); $data_map = $object->dataMap(); $object_attribute_id = $data_map['body']->attribute('id'); $object_attribute_version = $data_map['body']->attribute('version'); if (!eZURLObjectLink::fetch($url_id, $object_attribute_id, $object_attribute_version, false)) { $link_object_link = eZURLObjectLink::create( $url_id, $object_attribute_id, $object_attribute_version); $link_object_link->store(); }
I'm not sure this is the right way to do things so feel free to give me a better solution.
I steel don't understand why eZContentFunctions::createAndPublishObject method didn't create a record in ezurl_object_link table...
Friendly,
Ben.
Benjamin Plaquevent Project Manager Smile
You must be logged in to post messages in this topic!