You are here

function asin_widget_info in Amazon Product Advertisement API 6

Implementation of hook_widget_info().

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

asin/asin.module, line 273
Defines a field type for referencing an Amazon product.

Code

function asin_widget_info() {
  return array(
    'asin_autocomplete' => array(
      'label' => t('Product name autocomplete'),
      'field types' => array(
        'asin',
      ),
      'multiple values' => CONTENT_HANDLE_CORE,
      'callbacks' => array(
        'default value' => CONTENT_CALLBACK_DEFAULT,
      ),
    ),
    'asin_text' => array(
      'label' => t('ASIN or ISBN Text field'),
      'field types' => array(
        'asin',
      ),
      'multiple values' => CONTENT_HANDLE_CORE,
      'callbacks' => array(
        'default value' => CONTENT_CALLBACK_DEFAULT,
      ),
    ),
  );
}