You are here

function opigno_quiz_app_enable_calendar_integration in Opigno Quiz App 7

Enable Calendar App integration.

2 calls to opigno_quiz_app_enable_calendar_integration()
opigno_quiz_app_install in ./opigno_quiz_app.install
Implements hook_install().
opigno_quiz_app_modules_enabled in ./opigno_quiz_app.module
Implements hook_modules_enabled().

File

./opigno_quiz_app.install, line 262
Defines module install logic.

Code

function opigno_quiz_app_enable_calendar_integration() {
  $field = field_info_field('field_add_to_calendar');
  if (empty($field)) {
    field_create_field(array(
      'translatable' => '0',
      'entity_types' => array(),
      'settings' => array(
        'allowed_values' => array(
          '0',
          '1',
        ),
        'allowed_values_function' => '',
      ),
      'storage' => array(
        'type' => 'field_sql_storage',
        'settings' => array(),
        'module' => 'field_sql_storage',
        'active' => '1',
        'details' => array(
          'sql' => array(
            'FIELD_LOAD_CURRENT' => array(
              'field_data_field_add_to_calendar' => array(
                'value' => 'field_add_to_calendar_value',
              ),
            ),
            'FIELD_LOAD_REVISION' => array(
              'field_revision_field_add_to_calendar' => array(
                'value' => 'field_add_to_calendar_value',
              ),
            ),
          ),
        ),
      ),
      'foreign keys' => array(),
      'indexes' => array(
        'value' => array(
          'value',
        ),
      ),
      'field_name' => 'field_add_to_calendar',
      'type' => 'list_boolean',
      'module' => 'list',
      'active' => '1',
      'locked' => '0',
      'cardinality' => '1',
      'deleted' => '0',
      'columns' => array(
        'value' => array(
          'type' => 'int',
          'not null' => FALSE,
        ),
      ),
      'bundles' => array(
        'node' => array(
          'quiz',
        ),
      ),
    ));
  }
  $instance = field_info_instance('node', 'field_add_to_calendar', 'quiz');
  if (empty($instance)) {
    field_create_instance(array(
      'label' => 'Add to calendar',
      'widget' => array(
        'weight' => '31',
        'type' => 'options_onoff',
        'module' => 'options',
        'active' => 1,
        'settings' => array(
          'display_label' => 1,
        ),
      ),
      'settings' => array(
        'user_register_form' => FALSE,
      ),
      'display' => array(
        'default' => array(
          'label' => 'above',
          'type' => 'hidden',
          'weight' => '3',
          'settings' => array(),
        ),
        'teaser' => array(
          'type' => 'hidden',
          'label' => 'above',
          'settings' => array(),
          'weight' => 0,
        ),
      ),
      'required' => 0,
      'description' => 'Add reminder to calendar',
      'default_value' => array(
        array(
          'value' => 0,
        ),
      ),
      'field_name' => 'field_add_to_calendar',
      'entity_type' => 'node',
      'bundle' => 'quiz',
      'deleted' => '0',
    ));
  }
  $instance = field_info_instance('node', 'opigno_calendar_date', 'quiz');
  if (empty($instance)) {
    field_create_instance(array(
      'label' => 'Calendar Date',
      'widget' => array(
        'weight' => '33',
        'type' => 'date_popup',
        'module' => 'date',
        'active' => 1,
        'settings' => array(
          'input_format' => 'm/d/Y - H:i:s',
          'input_format_custom' => '',
          'year_range' => '-3:+3',
          'increment' => '15',
          'label_position' => 'above',
          'text_parts' => array(),
        ),
      ),
      'settings' => array(
        'default_value' => 'now',
        'default_value_code' => '',
        'default_value2' => 'same',
        'default_value_code2' => '',
        'user_register_form' => FALSE,
      ),
      'display' => array(
        'default' => array(
          'label' => 'above',
          'type' => 'hidden',
          'weight' => '4',
          'settings' => array(),
        ),
        'teaser' => array(
          'type' => 'hidden',
          'label' => 'above',
          'settings' => array(),
          'weight' => 0,
        ),
      ),
      'required' => 0,
      'description' => '',
      'field_name' => 'opigno_calendar_date',
      'entity_type' => 'node',
      'bundle' => 'quiz',
      'deleted' => '0',
    ));
  }
  variable_set('node_submitted_quiz_drag_drop', 0);
}