You are here

function nodereference_widget_info in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 5 nodereference.module \nodereference_widget_info()
  2. 6 modules/nodereference/nodereference.module \nodereference_widget_info()
  3. 6.2 modules/nodereference/nodereference.module \nodereference_widget_info()

Implementation of hook_widget_info().

We need custom handling of multiple values for the nodereference_select widget because we need to combine them into a options list rather than display multiple elements.

We will use the content module's default handling for default value.

Callbacks can be omitted if default handing is used. They're included here just so this module can be used as an example for custom modules that might do things differently.

File

modules/nodereference/nodereference.module, line 405
Defines a field type for referencing one node from another.

Code

function nodereference_widget_info() {
  return array(
    'nodereference_select' => array(
      'label' => t('Select list'),
      'field types' => array(
        'nodereference',
      ),
      'multiple values' => CONTENT_HANDLE_MODULE,
      'callbacks' => array(
        'default value' => CONTENT_CALLBACK_DEFAULT,
      ),
    ),
    'nodereference_buttons' => array(
      'label' => t('Check boxes/radio buttons'),
      'field types' => array(
        'nodereference',
      ),
      'multiple values' => CONTENT_HANDLE_MODULE,
      'callbacks' => array(
        'default value' => CONTENT_CALLBACK_DEFAULT,
      ),
    ),
    'nodereference_autocomplete' => array(
      'label' => t('Autocomplete text field'),
      'field types' => array(
        'nodereference',
      ),
      'multiple values' => CONTENT_HANDLE_CORE,
      'callbacks' => array(
        'default value' => CONTENT_CALLBACK_DEFAULT,
      ),
    ),
  );
}