You are here

function blockreference_widget_info in Block reference 6

Implementation of hook_widget_info().

We need custom handling of multiple values for the blockreference_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

./blockreference.module, line 351
Defines a field type for referencing a block from a node.

Code

function blockreference_widget_info() {
  return array(
    'blockreference_select' => array(
      'label' => t('Select list'),
      'field types' => array(
        'blockreference',
      ),
      'multiple values' => CONTENT_HANDLE_MODULE,
      'callbacks' => array(
        'default value' => CONTENT_CALLBACK_DEFAULT,
      ),
    ),
    'blockreference_select_sort' => array(
      'label' => t('Select list (with drag-and-drop sort)'),
      'field types' => array(
        'blockreference',
      ),
      'multiple values' => CONTENT_HANDLE_CORE,
      'callbacks' => array(
        'default value' => CONTENT_CALLBACK_DEFAULT,
      ),
    ),
    'blockreference_autocomplete' => array(
      'label' => t('Autocomplete text field'),
      'field types' => array(
        'blockreference',
      ),
      'multiple values' => CONTENT_HANDLE_CORE,
      'callbacks' => array(
        'default value' => CONTENT_CALLBACK_DEFAULT,
      ),
    ),
  );
}