You are here

function _pathfilter_settings in Path Filter 5.2

Same name and namespace in other branches
  1. 5 pathfilter.module \_pathfilter_settings()
  2. 6.2 pathfilter.module \_pathfilter_settings()
  3. 6 pathfilter.module \_pathfilter_settings()
  4. 7 pathfilter.module \_pathfilter_settings()

Helper settings function for hook_filter('settings').

1 call to _pathfilter_settings()
pathfilter_filter in ./pathfilter.module
Implementation of hook_filter().

File

./pathfilter.module, line 153
This filter takes internal Drupal paths in double quotes, written as e.g. "internal:node/99", and replaces them with the appropriate absolute http URL using Drupal's url() function [1]. E.g. for a site located at http://example.com/mysite

Code

function _pathfilter_settings($format) {
  $form = array();
  $form['pathfilter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Internal path filter'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['pathfilter']['pathfilter_link_absolute_' . $format] = array(
    '#type' => 'radios',
    '#title' => t('Convert internal paths to'),
    '#options' => array(
      1 => t('Absolute URL (including http://www.example.com)'),
      0 => t('Absolute path (relative to document root)'),
    ),
    '#default_value' => variable_get('pathfilter_link_absolute_' . $format, 1),
    '#description' => t('Should internal paths be transformed to absolute URLs, such as %absolute_url or absolute paths, like %absolute_path. Note that your changes may not appear until the cache has been cleared.', array(
      '%absolute_url' => 'http://www.example.com/my-page',
      '%absolute_path' => '/my-page',
    )),
  );
  $form['pathfilter']['pathfilter_process_all'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable automatic url processing for attributes.'),
    '#default_value' => variable_get('pathfilter_process_all', 1),
    '#description' => t('When this option is enabled, all %element_list elements will automatically have the servername and base path of their src, href, and action urls replaced with %internal. On editing of these elements, all instances of %internal will be replaced with the site\'s base path (%current_base_path).', array(
      '%element_list' => '<img>, <a>, <script>, <object>, and <form>',
      '%internal' => '\'internal:\'',
      '%current_base_path' => base_path(),
    )),
  );
  return $form;
}