Drupal PHP Cross Reference Content Management Systems

Source: /modules/filter/filter.pages.inc - 88 lines - 2302 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /**
   4   * @file
   5   * User page callbacks for the filter module.
   6   */
   7  
   8  
   9  /**
  10   * Menu callback; show a page with long filter tips.
  11   */
  12  function filter_tips_long() {
  13    $format_id = arg(2);
  14    if ($format_id) {
  15      $output = theme('filter_tips', array('tips' => _filter_tips($format_id, TRUE), 'long' => TRUE));
  16    }
  17    else {
  18      $output = theme('filter_tips', array('tips' => _filter_tips(-1, TRUE), 'long' => TRUE));
  19    }
  20    return $output;
  21  }
  22  
  23  
  24  /**
  25   * Returns HTML for a set of filter tips.
  26   *
  27   * @param $variables
  28   *   An associative array containing:
  29   *   - tips: An array containing descriptions and a CSS id in the form of
  30   *     'module-name/filter-id' (only used when $long is TRUE) for each
  31   *     filter in one or more text formats. Example:
  32   *     @code
  33   *       array(
  34   *         'Full HTML' => array(
  35   *           0 => array(
  36   *             'tip' => 'Web page addresses and e-mail addresses turn into links automatically.',
  37   *             'id' => 'filter/2',
  38   *           ),
  39   *         ),
  40   *       );
  41   *     @endcode
  42   *   - long: (optional) Whether the passed-in filter tips contain extended
  43   *     explanations, i.e. intended to be output on the path 'filter/tips'
  44   *     (TRUE), or are in a short format, i.e. suitable to be displayed below a
  45   *     form element. Defaults to FALSE.
  46   *
  47   * @see _filter_tips()
  48   * @ingroup themeable
  49   */
  50  function theme_filter_tips($variables) {
  51    $tips = $variables['tips'];
  52    $long = $variables['long'];
  53    $output = '';
  54  
  55    $multiple = count($tips) > 1;
  56    if ($multiple) {
  57      $output = '<h2>' . t('Text Formats') . '</h2>';
  58    }
  59  
  60    if (count($tips)) {
  61      if ($multiple) {
  62        $output .= '<div class="compose-tips">';
  63      }
  64      foreach ($tips as $name => $tiplist) {
  65        if ($multiple) {
  66          $output .= '<div class="filter-type filter-' . drupal_html_class($name) . '">';
  67          $output .= '<h3>' . $name . '</h3>';
  68        }
  69  
  70        if (count($tiplist) > 0) {
  71          $output .= '<ul class="tips">';
  72          foreach ($tiplist as $tip) {
  73            $output .= '<li' . ($long ? ' id="filter-' . str_replace("/", "-", $tip['id']) . '">' : '>') . $tip['tip'] . '</li>';
  74          }
  75          $output .= '</ul>';
  76        }
  77  
  78        if ($multiple) {
  79          $output .= '</div>';
  80        }
  81      }
  82      if ($multiple) {
  83        $output .= '</div>';
  84      }
  85    }
  86  
  87    return $output;
  88  }

title

Description

title

Description

title

Description

title

title

Body