You are here

function _glossify_content_settings in Glossify 7.4

The settings for configuring the glossify content filter.

1 string reference to '_glossify_content_settings'
glossify_filter_info in ./glossify.module
Implements hook_filter_info().

File

./glossify.module, line 137
Glossify module.

Code

function _glossify_content_settings($form, $form_state, $filter, $format, $defaults) {
  $filter->settings += $defaults;
  $types = array();
  $fields = array();

  // get all node types
  foreach (node_type_get_types() as $type) {
    $types[$type->type] = $type->name;
  }
  ksort($types);

  //get all fields that appear on node bundles
  foreach (field_info_fields() as $field) {
    if (isset($field['bundles']['node'])) {
      $fields[$field['field_name']] = $field['field_name'];
    }
  }
  ksort($fields);
  $settings['glossify_content_case_sensitivity'] = array(
    '#type' => 'checkbox',
    '#title' => t('Case sensitive'),
    '#description' => t('Whether or not the match is case sensitive.'),
    '#default_value' => $filter->settings['glossify_content_case_sensitivity'],
  );
  $settings['glossify_content_first_only'] = array(
    '#type' => 'checkbox',
    '#title' => t('First match only'),
    '#description' => t('Match and link only the first occurance.'),
    '#default_value' => $filter->settings['glossify_content_first_only'],
  );
  $settings['glossify_content_tooltips'] = array(
    '#type' => 'checkbox',
    '#title' => t('Tool tips'),
    '#description' => t('Enable tooltips displaying the node body when hovering the link.'),
    '#default_value' => $filter->settings['glossify_content_tooltips'],
  );
  $settings['glossify_content_tooltip_field'] = array(
    '#type' => 'select',
    '#title' => t('Tool tip field'),
    '#description' => t('Select the node field to be used for the tooltip. The field should appear on all selected content types. NOTE: multivalue fields will only use the first value (delta = 0).'),
    '#options' => $fields,
    '#default_value' => $filter->settings['glossify_content_tooltip_field'],
    '#states' => array(
      'invisible' => array(
        'input[name="filters[glossify_content][settings][glossify_content_tooltips]"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $settings['glossify_content_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types'),
    '#description' => t('Select the content types who\'s titles should be linked to their content page.'),
    '#options' => $types,
    '#default_value' => $filter->settings['glossify_content_types'],
  );
  return $settings;
}