I love this module. But, the tabs do not appear. Here is a filter to convert tabs into non-breaking spaces or the characters of your choice. Add this code to the module. Then configure the "input format" settings.

/**
 * Adding a filter to replace tabs with non-breaking spaces.
 */
 
function textareatabs_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(0 => t('Replace tabs with non-breaking spaces (or characters of your choice).'));
    case 'no cache':
      return $delta == 1; // No caching for the PHP evaluator.
    case 'description':
      switch ($delta) {
        case 0:
          return t('Replace tabs with non-breaking spaces (or characters of your choice).');
        default:
          return;
      }
    case 'process':
      switch ($delta) {
        case 0:
          return textareatabs_process($text, $format);
        default:
          return $text;
      }
    case 'settings':
      switch ($delta) {
        case 0:
          return textareatabs_settings($format);
        default:
          return;
      }
    default:
      return $text;
  }
}

function textareatabs_process($text, $format) {

  $replace = variable_get('filter_url_length_'. $format, '     ');
  return str_replace("\t", $replace, $text);
}

function textareatabs_settings($format) {
  $form['filter_tabs'] = array(
    '#type' => 'fieldset',
    '#title' => t('URL filter'),
    '#collapsible' => TRUE,
  );
  $form['filter_tabs']['textareatabs_character_'. $format] = array(
    '#type' => 'textfield',
    '#title' => t('Replacement string for each tab'),
    '#default_value' => variable_get('filter_url_length_'. $format, '     '),
    '#maxlength' => 4,
  );
  return $form;
}

Comments

jpsalter’s picture

Sorry - I pasted in unfinished code. Here is the update.

function textareatabs_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(0 => t('Replace tabs with non-breaking spaces.'));
    case 'no cache':
      return $delta == 1; // No caching for the PHP evaluator.
    case 'description':
      switch ($delta) {
        case 0:
          return t('Replace tabs with non-breaking spaces.');
        default:
          return;
      }
    case 'process':
      switch ($delta) {
        case 0:
          return textareatabs_process($text, $format);
        default:
          return $text;
      }
    case 'settings':
      switch ($delta) {
        case 0:
          return textareatabs_filter_settings($format);
        default:
          return;
      }
    default:
      return $text;
  }
}

function textareatabs_process($text, $format) {

  $replace = variable_get('textareatabs_character_'. $format, '     ');
  return str_replace("\t", $replace, $text);
}

function textareatabs_filter_settings($format) {
  $form['filter_tabs'] = array(
    '#type' => 'fieldset',
    '#title' => t('Replace tabs with characters'),
    '#collapsible' => TRUE,
  );
  $form['filter_tabs']['textareatabs_character_'. $format] = array(
    '#type' => 'textfield',
    '#title' => t('Replacement string for each tab'),
    '#default_value' => variable_get('textareatabs_character_'. $format, '     '),
    '#maxlength' => 4,
  );
  return $form;
}


smokris’s picture

Version: 5.x-0.1 » 6.x-0.2
Assigned: Unassigned » smokris
Status: Active » Fixed

Eek. Sorry this sat in the queue for so long.

Thanks. I've committed this to the 6.x branch. It's in the 6.x-0.2 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.