[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @file
   5   * Webform module markup component.
   6   */
   7  
   8  /**
   9   * Implements _webform_defaults_component().
  10   */
  11  function _webform_defaults_markup() {
  12    return array(
  13      'name' => '',
  14      'form_key' => NULL,
  15      'pid' => 0,
  16      'weight' => 0,
  17      'value' => '',
  18      'extra' => array(
  19        'format' => FILTER_FORMAT_DEFAULT,
  20        'private' => FALSE,
  21      ),
  22    );
  23  }
  24  
  25  /**
  26   * Implements _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    return $form;
  42  }
  43  
  44  /**
  45   * Implements _webform_render_component().
  46   */
  47  function _webform_render_markup($component, $value = NULL, $filter = TRUE) {
  48    $node = isset($component['nid']) ? node_load($component['nid']) : NULL;
  49  
  50    $element = array(
  51      '#type' => 'markup',
  52      '#title' => $filter ? NULL : $component['name'],
  53      '#weight' => $component['weight'],
  54      '#markup' => $filter ? _webform_filter_values(check_markup($component['value'], $component['extra']['format'], FALSE), $node, NULL, NULL, FALSE) : $component['value'],
  55      '#format' => $component['extra']['format'],
  56      '#theme_wrappers' => array('webform_element_wrapper'),
  57      '#post_render' => array('webform_element_wrapper'),
  58      '#translatable' => array('title', 'markup'),
  59    );
  60  
  61    // TODO: Remove when #markup becomes available in D7.
  62    $element['#value'] = $element['#markup'];
  63  
  64    return $element;
  65  }
  66  
  67  /**
  68   * Implements _webform_display_component().
  69   */
  70  function _webform_display_markup($component, $value, $format = 'html') {
  71    return array();
  72  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7