You are here

function _pathfilter_settings in Path Filter 7

Same name and namespace in other branches
  1. 5.2 pathfilter.module \_pathfilter_settings()
  2. 5 pathfilter.module \_pathfilter_settings()
  3. 6.2 pathfilter.module \_pathfilter_settings()
  4. 6 pathfilter.module \_pathfilter_settings()
1 string reference to '_pathfilter_settings'
pathfilter_filter_info in ./pathfilter.module
Implements hook_filter_info().

File

./pathfilter.module, line 155
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($form, &$form_state, $filter, $format, $defaults, $filters) {
  $filter->settings += $defaults;
  $elements = array();
  $elements['link_absolute'] = array(
    '#type' => 'radios',
    '#title' => t('Convert internal paths to'),
    '#options' => array(
      t('Absolute URL (including http://www.example.com)'),
      t('Absolute path (relative to document root)'),
    ),
    '#default_value' => $filter->settings['link_absolute'],
    '#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',
    )),
  );
  $elements['process_all'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable automatic url processing for attributes.'),
    '#default_value' => $filter->settings['process_all'],
    '#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 $elements;
}