You are here

function invisimail_settings_form in Invisimail 7

Returns the form fragment for a given encoder's settings form.

Parameters

$form: The form we are adding to.

$form_state: The state of the form we are adding to.

string $encoder: The name of the encoder whose settings form we want.

array $settings: The current settings for the form fragment values.

Return value

array A form fragment.

2 calls to invisimail_settings_form()
invisimail_encode_settings in ./invisimail.module
Settings callback for all encoding filters.
invisimail_field_formatter_settings_form in ./invisimail.module
Implements callback_field_formatter_settings_form().

File

./invisimail.module, line 146
This module provides a filter that will search content for email addresses and replace them with their ascii equivalents before display. This is not a complete protection from spam harvesters, but it is some help.

Code

function invisimail_settings_form($form, &$form_state, $encoder, array $settings) {
  $element['chunk'] = array(
    '#type' => 'checkbox',
    '#title' => t('Break up text for filtering'),
    '#weight' => 5,
    '#default_value' => $settings['chunk'],
    '#description' => t('Break up the text to be filtered into chunks with and
                          without anchor tags.  Selecting this option may slow
                          down the filtering of text slightly, but will provide
                          better error messages in the <em>Recent log entries</em>
                          should content not render as you expect it when there
                          are e-mail addresses to obfuscate.'),
  );
  $encoder = invisimail_get_encoder($settings['encoder']);
  if (function_exists($encoder['settings callback'])) {
    $element += $encoder['settings callback']($form, $form_state, $settings);
  }
  elseif ($encoder['settings callback']) {
    watchdog('invisimail', 'Invalid settings callback: @callback', array(
      '@callback' => $encoder['settings callback'],
    ));
  }

  // If there was nothing specified, that's not an error and we just continue normally.
  return $element;
}