You are here

function _advpoll_installed_fields in Advanced Poll 7

Same name and namespace in other branches
  1. 7.3 advpoll.install \_advpoll_installed_fields()
  2. 7.2 advpoll.install \_advpoll_installed_fields()

Returns a structured array defining the fields created by this content type.

This is factored into this function so it can be used in both node_example_install() and node_example_uninstall().

Return value

An associative array specifying the fields we wish to add to our new node type.

2 calls to _advpoll_installed_fields()
advpoll_install in ./advpoll.install
advpoll_uninstall in ./advpoll.install
Implements hook_uninstall().

File

./advpoll.install, line 149
Install file for Advanced Poll Much thanks to the example modules. MW

Code

function _advpoll_installed_fields() {
  $t = get_t();
  return array(
    // -- Choices field --
    'advpoll_choice' => array(
      'active' => '1',
      'cardinality' => '-1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'advpoll_choice',
      'foreign keys' => array(),
      'indexes' => array(
        'choice' => array(
          0 => 'choice',
        ),
      ),
      'module' => 'advpoll_field',
      'settings' => array(),
      'translatable' => '0',
      'type' => 'advpoll',
    ),
    // -- Max number of choices field
    'advpoll_max_choices' => array(
      'active' => '1',
      'cardinality' => '1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'advpoll_max_choices',
      'foreign keys' => array(),
      'indexes' => array(),
      'module' => 'number',
      'settings' => array(),
      'translatable' => '0',
      'type' => 'number_integer',
    ),
    // -- Poll behavior field
    'advpoll_behavior' => array(
      'active' => '1',
      'cardinality' => '1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'advpoll_behavior',
      'foreign keys' => array(),
      'indexes' => array(
        'value' => array(
          0 => 'value',
        ),
      ),
      'module' => 'list',
      'settings' => array(
        'allowed_values' => array(
          'approval' => $t('Approval voting'),
          'pool' => $t('Pool votes and choices'),
        ),
        'allowed_values_function' => '',
      ),
      'translatable' => '0',
      'type' => 'list_text',
    ),
    // -- Poll closed field
    'advpoll_closed' => array(
      'active' => '1',
      'cardinality' => '1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'advpoll_closed',
      'foreign keys' => array(),
      'indexes' => array(
        'value' => array(
          0 => 'value',
        ),
      ),
      'module' => 'list',
      'settings' => array(
        'allowed_values' => array(
          'close' => $t('Close poll'),
          'open' => $t('Open poll'),
        ),
        'allowed_values_function' => '',
      ),
      'translatable' => '0',
      'type' => 'list_text',
    ),
    // -- Cookie duration field
    'advpoll_cookie_duration' => array(
      'active' => '1',
      'cardinality' => '1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'advpoll_cookie_duration',
      'foreign keys' => array(),
      'indexes' => array(),
      'module' => 'number',
      'settings' => array(),
      'translatable' => '0',
      'type' => 'number_integer',
    ),
    // Poll date field
    'advpoll_dates' => array(
      'active' => '1',
      'cardinality' => '1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'advpoll_dates',
      'foreign keys' => array(),
      'indexes' => array(),
      'module' => 'date',
      'settings' => array(
        'cache_count' => '4',
        'cache_enabled' => 0,
        'granularity' => array(
          'day' => 'day',
          'hour' => 0,
          'minute' => 0,
          'month' => 'month',
          'second' => 0,
          'year' => 'year',
        ),
        'timezone_db' => '',
        'todate' => 'required',
        'tz_handling' => 'none',
      ),
      'translatable' => '0',
      'type' => 'datetime',
    ),
    // Poll mode field
    'advpoll_mode' => array(
      'active' => '1',
      'cardinality' => '1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'advpoll_mode',
      'foreign keys' => array(),
      'indexes' => array(
        'value' => array(
          0 => 'value',
        ),
      ),
      'module' => 'list',
      'settings' => array(
        'allowed_values' => array(
          'normal' => $t('Normal (handled by default Vote API settings)'),
          'cookie' => $t('By Cookie'),
          'unlimited' => $t('Unlimited (Allows those with permission to vote on polls to vote as many times as they wish. Write-ins are disabled).'),
        ),
        'allowed_values_function' => '',
      ),
      'translatable' => '0',
      'type' => 'list_text',
    ),
    // Poll options field
    'advpoll_options' => array(
      'active' => '1',
      'cardinality' => '4',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'advpoll_options',
      'foreign keys' => array(),
      'indexes' => array(
        'value' => array(
          0 => 'value',
        ),
      ),
      'module' => 'list',
      'settings' => array(
        'allowed_values' => array(
          'writein' => $t('Allow users to cast write-in votes'),
          'electoral' => $t('Restrict voting to electoral list'),
          'showvotes' => $t('Show individual votes'),
          'block' => $t('Generate a block for this poll'),
        ),
        'allowed_values_function' => '',
      ),
      'translatable' => '0',
      'type' => 'list_text',
    ),
    // -- Poll Results field
    'advpoll_results' => array(
      'active' => '1',
      'cardinality' => '1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'advpoll_results',
      'foreign keys' => array(),
      'indexes' => array(
        'value' => array(
          0 => 'value',
        ),
      ),
      'module' => 'list',
      'settings' => array(
        'allowed_values' => array(
          'aftervote' => $t('After voting'),
          'afterclose' => $t('After poll is closed'),
          'never' => 'Never',
        ),
        'allowed_values_function' => '',
      ),
      'translatable' => '0',
      'type' => 'list_text',
    ),
  );
}