[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/webform/components/ -> markup.inc (source)

   1  <?php
   2  // $Id: markup.inc,v 1.13.2.4 2010/09/28 22:43:56 quicksketch Exp $
   3  
   4  /**
   5   * @file
   6   * Webform module markup component.
   7   */
   8  
   9  /**
  10   * Implementation of _webform_defaults_component().
  11   */
  12  function _webform_defaults_markup() {
  13    return array(
  14      'name' => '',
  15      'form_key' => NULL,
  16      'pid' => 0,
  17      'weight' => 0,
  18      'value' => '',
  19      'extra' => array(
  20        'format' => FILTER_FORMAT_DEFAULT,
  21      ),
  22    );
  23  }
  24  
  25  /**
  26   * Implementation of _webform_edit_component().
  27   */
  28  function _webform_edit_markup($component) {
  29    $form = array();
  30    $form['markup']['value'] = array(
  31      '#type' => 'textarea',
  32      '#title' => t('Value'),
  33      '#default_value' => $component['value'],
  34      '#description' => t('Markup allows you to enter custom HTML or PHP logic into your form.') . theme('webform_token_help'),
  35      '#weight' => -1,
  36      '#parents' => array('value'),
  37    );
  38    // Add the filter form.
  39    $form['markup']['format'] = filter_form($component['extra']['format'], 0, array('extra', 'format'));
  40  
  41    $form['extra']['description'] = array(); // No description for markup.
  42    $form['display'] = array('#type' => 'markup'); // Hide the display options.
  43    $form['display']['title_display'] = array();
  44  
  45    return $form;
  46  }
  47  
  48  /**
  49   * Implementation of _webform_render_component().
  50   */
  51  function _webform_render_markup($component, $value = NULL, $filter = TRUE) {
  52    $element = array(
  53      '#type'   => 'markup',
  54      '#title'  => $filter ? _webform_filter_xss($component['name']) : $component['name'],
  55      '#weight' => $component['weight'],
  56      '#markup' => $filter ? _webform_filter_values(check_markup($component['value'], $component['extra']['format'], FALSE), NULL, NULL, NULL, FALSE) : $component['value'],
  57      '#input_format' => $component['extra']['format'],
  58      '#prefix' => '<div class="webform-component webform-component-' . $component['type'] . '" id="webform-component-' . $component['form_key'] . '">',
  59      '#suffix' => '</div>',
  60      '#webform_component' => $component,
  61    );
  62  
  63    // TODO: Remove when #markup becomes available in D7.
  64    $element['#value'] = $element['#markup'];
  65  
  66    return $element;
  67  }
  68  
  69  /**
  70   * Implementation of _webform_display_component().
  71   */
  72  function _webform_display_markup($component, $value, $format = 'html') {
  73    return array();
  74  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7