You are here

function _bbcode_settings in Bbcode 7

Implement hook_filter_FILTER_settings

1 string reference to '_bbcode_settings'
bbcode_filter_info in ./bbcode.module
Implement hook_filter_info

File

./bbcode.module, line 45

Code

function _bbcode_settings($form, &$form_state, $filter, $format, $defaults, $filters) {
  $filter->settings += $defaults;
  $form = array();
  $form['bbcode_make_links'] = array(
    '#type' => 'select',
    '#title' => t('Convert addresses to links'),
    '#default_value' => $filter->settings['bbcode_make_links'],
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#description' => t('Turn web and e-mail addresses into clickable links. This is useful if content authors do not explicitly mark addresses as links with [url] and [email] tags.'),
  );
  $form['bbcode_filter_nofollow'] = array(
    '#type' => 'select',
    '#title' => t('Spam link deterrent'),
    '#default_value' => $filter->settings['bbcode_filter_nofollow'],
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#description' => t('If enabled, BBCode will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'),
  );
  $form['bbcode_encode_mailto'] = array(
    '#type' => 'select',
    '#title' => t('Email address encoding'),
    '#default_value' => $filter->settings['bbcode_encode_mailto'],
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#description' => t('Whether to encode email addresses with javascript. With this method you will have clickable mailto links, but it will be a bit harder for spam robots to collect them.'),
  );
  $form['bbcode_paragraph_breaks'] = array(
    '#type' => 'select',
    '#title' => t('Smart paragraph and line breaks'),
    '#default_value' => $filter->settings['bbcode_paragraph_breaks'],
    '#options' => array(
      t('Disabled'),
      t('Line breaks only'),
      t('Line and paragraph breaks'),
    ),
    '#description' => t('Add line and paragraph breaks to text, excluding text in preformatted code blocks. If you disable this option, you need to enable Drupal\'s "Line break converter". Don\'t use both together!'),
  );
  $form['bbcode_debug'] = array(
    '#type' => 'select',
    '#title' => t('Print debugging info'),
    '#default_value' => $filter->settings['bbcode_debug'],
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#description' => t('Print BBCode parse date and execution time. This option should be disabled on production sites. You may need to clear the cache after changing this option.'),
  );
  return $form;
}