0
votes

I am having trouble finding sources of information or example code for a creating a custom module (or any means) to edit the node edit/insert pages.

I am trying to create a Flickr Integration for a node. The Flickr API is not an issue and i can resolve those, it's the Drupal API issues i could use some help or resources of information on.

Here is what i am trying to achive.

  1. User attempts to add or edit a node
  2. User inserts a keyword into a field and presses a button (Get Photos)
  3. Flickr API returns and displays a few images
  4. User clicks on an image and the URL of the image is then added to an input field
  5. on node save or node update a field such as $node->flickrImage[0][value] is updated with the URL selected in 4.
  6. the variable is the available when ever the node is rendered.

I'm not quite sure how to achieve this - I simply need some example code of modifying the node edit/insert pages and I think I can work the rest out.

Please Help!

Thanks, Shadi

2

2 Answers

2
votes

It looks for me, that you can write own CCK field type, so that you can add this to desired content type and process user's input & work with flickr API.

this way, it's easier to manage this field and control it, plus it will be automatically added to node edit/create forms, node loads, etc. This article might help http://www.lullabot.com/articles/creating-custom-cck-fields

Second way, is to use hook_form_alter

function module_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'product_node_form') {
    //do smth
    }
}

In this case, form_id you want to change, will be {content_type}_node_form. there you can add your field, and process it on hook_nodeapi

0
votes

Here is a link for node edit form alter solution .. http://drupal.org/node/101092