simpleads_campaigns.install in SimpleAds 7.2
Same filename and directory in other branches
SimpleAds Campaigns module install.
File
modules/simpleads_campaigns/simpleads_campaigns.installView source
<?php
/**
* @file
* SimpleAds Campaigns module install.
*/
/**
* Implements hook_install().
*/
function simpleads_campaigns_install() {
$t = get_t();
$fields = array(
array(
'field_name' => 'field_adcamp_list',
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'foreign keys' => array(),
'indexes' => array(
'value' => array(
0 => 'value',
),
),
'locked' => 1,
'module' => 'list',
'settings' => array(
'allowed_values' => array(),
'allowed_values_function' => '_simpleads_field_adcamp_list',
),
'translatable' => '1',
'type' => 'list_text',
),
array(
'field_name' => 'field_adcamp_type',
'active' => '1',
'cardinality' => '-1',
'deleted' => '0',
'entity_types' => array(),
'foreign keys' => array(),
'indexes' => array(
'value' => array(
0 => 'value',
),
),
'locked' => 1,
'module' => 'list',
'settings' => array(
'allowed_values' => array(),
'allowed_values_function' => '_simpleads_campaigns_types',
),
'translatable' => '0',
'type' => 'list_text',
),
array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_adcamp_impressions',
'foreign keys' => array(),
'indexes' => array(),
'locked' => 1,
'module' => 'number',
'settings' => array(),
'translatable' => '0',
'type' => 'number_integer',
),
array(
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'field_name' => 'field_adcamp_clicks',
'foreign keys' => array(),
'indexes' => array(),
'locked' => 1,
'module' => 'number',
'settings' => array(),
'translatable' => '0',
'type' => 'number_integer',
),
array(
'field_name' => 'field_adcamp_date',
'active' => '1',
'cardinality' => '1',
'deleted' => '0',
'entity_types' => array(),
'foreign keys' => array(),
'indexes' => array(),
'locked' => 1,
'module' => 'date',
'settings' => array(
'cache_count' => '4',
'cache_enabled' => 0,
'granularity' => array(
'day' => 'day',
'hour' => 'hour',
'minute' => 'minute',
'month' => 'month',
'second' => 0,
'year' => 'year',
),
'timezone_db' => 'UTC',
'todate' => 'optional',
'tz_handling' => 'site',
),
'translatable' => '0',
'type' => 'datetime',
),
);
foreach ($fields as $field) {
field_create_field($field);
}
$instance = array(
'bundle' => 'simpleads',
'default_value' => array(),
'deleted' => '0',
'description' => $t('Please select campaign.'),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'list',
'settings' => array(),
'type' => 'hidden',
'weight' => -1,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'list',
'settings' => array(),
'type' => 'hidden',
'weight' => -1,
),
),
'entity_type' => 'node',
'field_name' => 'field_adcamp_list',
'label' => $t('Campaign'),
'required' => FALSE,
'settings' => array(
'allowed_values_function' => '_simpleads_field_adcamp_list',
'user_register_form' => FALSE,
),
'user_register_form' => FALSE,
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_select',
'weight' => 9,
),
);
field_create_instance($instance);
$instance = array(
'bundle' => 'simpleads_campaigns',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'list',
'settings' => array(),
'type' => 'list_default',
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_adcamp_type',
'label' => 'Type',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_buttons',
'weight' => '1',
),
);
field_create_instance($instance);
$instance = array(
'bundle' => 'simpleads_campaigns',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'number',
'settings' => array(
'decimal_separator' => '.',
'prefix_suffix' => TRUE,
'scale' => 0,
'thousand_separator' => ' ',
),
'type' => 'number_integer',
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_adcamp_impressions',
'label' => 'Impressions count',
'required' => 0,
'settings' => array(
'max' => '',
'min' => '',
'prefix' => '',
'suffix' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'number',
'settings' => array(),
'type' => 'number',
'weight' => '5',
),
);
field_create_instance($instance);
$instance = array(
'bundle' => 'simpleads_campaigns',
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'number',
'settings' => array(
'decimal_separator' => '.',
'prefix_suffix' => TRUE,
'scale' => 0,
'thousand_separator' => ' ',
),
'type' => 'number_integer',
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_adcamp_clicks',
'label' => 'Clicks count',
'required' => 0,
'settings' => array(
'max' => '',
'min' => '',
'prefix' => '',
'suffix' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'number',
'settings' => array(),
'type' => 'number',
'weight' => '10',
),
);
field_create_instance($instance);
$instance = array(
'bundle' => 'simpleads_campaigns',
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'date',
'settings' => array(
'format_type' => 'long',
'fromto' => 'both',
'multiple_from' => '',
'multiple_number' => '',
'multiple_to' => '',
),
'type' => 'date_default',
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_adcamp_date',
'label' => $t('Date'),
'required' => 0,
'settings' => array(
'default_value' => 'now',
'default_value2' => 'same',
'default_value_code' => '',
'default_value_code2' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'date',
'settings' => array(
'increment' => '15',
'input_format' => 'm/d/Y - H:i:s',
'input_format_custom' => '',
'label_position' => 'above',
'text_parts' => array(),
'year_range' => '-3:+3',
),
'type' => 'date_popup',
'weight' => '20',
),
);
field_create_instance($instance);
node_types_rebuild();
// Reset menu, comments and other default options.
variable_set('menu_options_simpleads_campaigns', array());
variable_set('node_options_simpleads_campaigns', array());
variable_set('comment_simpleads_campaigns', 1);
}
/**
* Implements hook_uninstall().
*/
function simpleads_campaigns_uninstall() {
field_delete_field('field_adcamp_list');
field_delete_field('field_adcamp_type');
field_delete_field('field_adcamp_impressions');
field_delete_field('field_adcamp_clicks');
field_delete_field('field_adcamp_date');
node_types_rebuild();
variable_del('menu_options_simpleads_campaigns');
variable_del('node_options_simpleads_campaigns');
variable_del('comment_simpleads_campaigns');
}
Functions
Name | Description |
---|---|
simpleads_campaigns_install | Implements hook_install(). |
simpleads_campaigns_uninstall | Implements hook_uninstall(). |