You are here

function autofill_init in Autofill 6

Implements hook_init().

File

./autofill.module, line 19
Main module file for the autofill module for Nojoshmo

Code

function autofill_init() {

  // Add jQuery Autofill library
  if ($path = libraries_get_path('jquery-autofill')) {
    drupal_add_js($path . '/jquery.autofill.min.js');
  }

  // Include user generated conditions for Autofill
  $path = 'sites/default/files';
  if (file_exists($path . '/autofill.js')) {

    // Include user generated conditions in sites/all/default/files/autofill.js
    drupal_add_js($path . '/autofill.js');
  }
  else {

    // Include user generated conditions from admin/settings/autofill
    $path = drupal_get_path('module', 'autofill');
    drupal_add_js($path . '/js/autofill.js');
  }
  $fields = variable_get('autofill_id_field_combos', array());
  if (empty($fields)) {

    // Get fields.
    $fields_pre = array(
      array(
        'id' => '#edit-info',
        'value' => 'eg. Add title here',
        'pre' => 'Hallo world',
      ),
    );
    variable_set('autofill_id_field_combos', $fields_pre);
  }
}