[development] noderefernace cck

Caleb O'Connell caleb at caleboconnell.com
Thu May 28 15:12:52 UTC 2009


The following is from the noderefernce widget function which looks to be the 
best place to put in my code for adding two free entry text fields.  I 
changed the name to beerlist throughout for my module purposes.  The other 
place would be under nodereference_element, but I am not sure which would be 
best, and if a simple for each would work to create my fields.


  switch ($field['widget']['type']) {
    case 'beerlist_select':
      $element = array(
        '#type' => 'beerlist_select',
        '#default_value' => $items,
      );
      break;

    case 'beerlist_buttons':
      $element = array(
        '#type' => 'beerlist_buttons',
        '#default_value' => $items,
      );
      break;

    case 'beerlist_autocomplete':
      $element = array(
        '#type' => 'beerlist_autocomplete',
        '#default_value' => isset($items[$delta]) ? $items[$delta] : NULL,
        '#value_callback' => 'beerlist_autocomplete_value',
      );
      break;
  }
  return $element;
}


Caleb O'Connell wrote:

> I am looking to get info about the cck module in drupal.  I've been trying
> to write a cck module that will basically do the exact same as
> nodereference but with two free
> entry text fields to go along with it.  Basically, one field to be the
> noderef lookup
> and two to add prices to associate to the referred field.  I wasn't sure
> who I could get in touch with in the cck development who is familiar with
> this so I can ask some questions about where to put the code I want in
> place to make the custom module I was
> looking for.  Thanks again in advance.
> 

-- 
-- Caleb O'Connell
-- Portlandtaps.com


More information about the development mailing list