views_natural_sort_text_field_test.install 949 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
<?php

/**
 * @file
 * Install file for the testing module for Views Natural Sort Text Field.
 */

/**
 * Implements hook_install().
 */
function views_natural_sort_text_field_test_install() {
  node_types_rebuild();
  $field_name = 'field_test_vns_sort';
  // Make sure the field doesn't already exist.
  if (!field_info_field($field_name)) {
    // Create the field.
    $field = array(
      'field_name' => $field_name,
      'type' => 'text',
      'views_natural_sort_enable_sort' => TRUE,
      'settings' => array(
        'max_length' => 64,
      ),
    );
    field_create_field($field);

    // Create the instance.
    $instance = array( 'field_name' => $field_name,
      'entity_type' => 'node',
      'bundle' => 'vns_text_field_test_content',
      'label' => 'Test VNS Sort',
      'description' => 'Test text to test Views Natural Sort functionality.',
      'required' => TRUE,
    );
    field_create_instance($instance);
  }
}