function _advpoll_installed_instances in Advanced Poll 7.3
Same name and namespace in other branches
- 7 advpoll.install \_advpoll_installed_instances()
- 7.2 advpoll.install \_advpoll_installed_instances()
Returns a structured array defining the instances for 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 instances we wish to add to our new node type.
1 call to _advpoll_installed_instances()
- advpoll_install in ./
advpoll.install - Implements hook_install().
File
- ./
advpoll.install, line 372 - Install file for Advanced Poll.
Code
function _advpoll_installed_instances() {
$t = get_t();
return array(
// Choices field.
'advpoll_choice' => array(
'default_value' => NULL,
'deleted' => '0',
'description' => $t('Add at least 2 choices for your poll. Write-in values indicate user generated content. If you approve of a choice that has been written in by a user, uncheck it and it will be integrated into the poll for others to vote upon.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'settings' => array(),
'type' => 'hidden',
'weight' => '1',
),
'example_node_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'advpoll_choice',
'label' => $t('Poll choice'),
'required' => 1,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'advpoll_field',
'settings' => array(),
'type' => 'advpoll_write_in',
'weight' => '1',
),
),
// Max number of choices field.
'advpoll_max_choices' => array(
'default_value' => array(
0 => array(
'value' => '1',
),
),
'deleted' => '0',
'description' => $t('Select the maximum number of choices that can be voted upon.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'number',
'settings' => array(
'decimal_separator' => '.',
'prefix_suffix' => TRUE,
'scale' => 0,
'thousand_separator' => ' ',
),
'type' => 'hidden',
'weight' => 2,
),
'example_node_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'advpoll_max_choices',
'label' => $t('Maximum choices'),
'required' => 1,
'settings' => array(
'max' => '',
'min' => '1',
'prefix' => '',
'suffix' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'number',
'settings' => array(),
'type' => 'number',
'weight' => '2',
),
),
// Date field.
'advpoll_dates' => array(
'deleted' => '0',
'description' => $t('Select the date range that controls the availability of this poll.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'date',
'settings' => array(
'format_type' => 'long',
'fromto' => 'both',
'multiple_from' => '',
'multiple_number' => '',
'multiple_to' => '',
),
'type' => 'hidden',
'weight' => 5,
),
'example_node_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'advpoll_dates',
'label' => $t('Poll availability'),
'required' => 0,
'settings' => array(
'default_value' => 'now',
'default_value2' => 'strtotime',
'default_value_code' => '',
'default_value_code2' => '+30 days',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'date',
'settings' => array(
'increment' => '15',
'input_format' => 'Y-m-d H:i:s',
'input_format_custom' => '',
'label_position' => 'above',
'text_parts' => array(),
'year_range' => '-0:+1',
),
'type' => 'date_popup',
'weight' => '3',
),
),
// Open/Closed field.
'advpoll_closed' => array(
'default_value' => array(
0 => array(
'value' => 'open',
),
),
'deleted' => '0',
'description' => $t('When closed, a poll may no longer be voted upon but will display its results if settings allow. For blocks, polls that are enabled to show results will show results, otherwise the block will no longer be available.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'list',
'settings' => array(),
'type' => 'hidden',
'weight' => 6,
),
'example_node_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'advpoll_closed',
'label' => $t('Close poll'),
'required' => 1,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_buttons',
'weight' => '4',
),
),
// Options fields.
'advpoll_options' => array(
'default_value' => array(
0 => array(
'value' => 'showvotes',
),
),
'deleted' => '0',
'description' => $t('Permission settings are necessary for allowing write-in voting, visibility of individual votes and administration of electoral lists.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'list',
'settings' => array(),
'type' => 'hidden',
'weight' => 3,
),
'example_node_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'advpoll_options',
'label' => $t('Voting options'),
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_buttons',
'weight' => '5',
),
),
// Mode field.
'advpoll_mode' => array(
'default_value' => array(
0 => array(
'value' => 'normal',
),
),
'deleted' => '0',
'description' => $t('Warning, changing this setting after votes have already been recorded for this poll will cause existing votes to be flushed.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'list',
'settings' => array(),
'type' => 'hidden',
'weight' => 4,
),
'example_node_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'advpoll_mode',
'label' => $t('Vote storage mode'),
'required' => 1,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_buttons',
'weight' => '6',
),
),
// Cookie duration field.
'advpoll_cookie_duration' => array(
'default_value' => array(
0 => array(
'value' => '60',
),
),
'deleted' => '0',
'description' => $t('If the poll\'s voting availability is being controlled by a cookie, this value determine how long to wait between votes in minutes.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'number',
'settings' => array(
'decimal_separator' => '.',
'prefix_suffix' => TRUE,
'scale' => 0,
'thousand_separator' => ' ',
),
'type' => 'hidden',
'weight' => 8,
),
'example_node_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'advpoll_cookie_duration',
'label' => $t('Cookie duration'),
'required' => 0,
'settings' => array(
'max' => '',
'min' => '1',
'prefix' => '',
'suffix' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'number',
'settings' => array(),
'type' => 'number',
'weight' => '7',
),
),
// Results field.
'advpoll_results' => array(
'default_value' => array(
0 => array(
'value' => 'aftervote',
),
),
'deleted' => '0',
'description' => $t('This value determines when to show the results of a poll. By default, while voting is on going, users will see the results so long as they are no longer eligible to vote. To display results without allowing an opportunity to vote, select \'After poll is closed\' and close the poll.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'list',
'settings' => array(),
'type' => 'hidden',
'weight' => 9,
),
'example_node_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'advpoll_results',
'label' => $t('Display results'),
'required' => 1,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_buttons',
'weight' => '8',
),
),
// Poll behavior field.
'advpoll_behavior' => array(
'default_value' => array(
0 => array(
'value' => 'approval',
),
),
'deleted' => '0',
'description' => $t('Approval voting weighs each vote against each individual choice rather than pooling all votes.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'list',
'settings' => array(),
'type' => 'hidden',
'weight' => 7,
),
'example_node_list' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'advpoll_behavior',
'label' => $t('Voting behavior'),
'required' => 1,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_buttons',
'weight' => '10',
),
),
);
}