You are here

function _purl_options in Persistent URL 6

Same name and namespace in other branches
  1. 7 purl.module \_purl_options()

Helper function, returns form options for modifier types.

Parameters

$active: only return enabled types. Defaults to true.

Return value

array of options, keys are machine names and values are the human readable counterparts.

7 calls to _purl_options()
purl_admin in ./purl.admin.inc
Page callback for the purl administration page.
purl_cache::__construct in ./purl.module
purl_form in ./purl.module
Generates a persistent url form element that can be dropped into a FormAPI form array. Includes validation, but insert/update must be handled by the implementing submit handler.
purl_get_normal_path in ./purl.module
Process a query string into its respective processors and modifiers and return the adjusted query string. If true, the $activate argument is used to call provider callbacks for a given query string. All values are static cached for a given query…
purl_settings_form in ./purl.admin.inc
Settings form for choosing the operating mode of purl

... See full list

File

./purl.module, line 760

Code

function _purl_options($active = TRUE) {
  static $enabled_options;
  if (isset($enabled_options) && $active) {
    return $enabled_options;
  }

  // @see http://drupal.org/node/573646#comment-2589772 & http://drupal.org/node/923724.
  module_load_include('module', 'ctools', 'ctools');
  ctools_include('plugins');
  $options = array();
  foreach (ctools_get_plugins('purl', 'processor') as $key => $processor) {
    if (!empty($processor['title'])) {
      $options[$key] = $processor['title'];
    }
  }
  if ($active) {
    $enabled = variable_get('purl_types', array(
      'path' => 'path',
    ));
    $options = array_intersect_key($options, array_filter($enabled));
  }
  return $options;
}