[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

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

   1  <?php
   2  // $Id: fieldset.inc,v 1.11.2.4 2010/09/28 22:43:55 quicksketch Exp $
   3  
   4  /**
   5   * @file
   6   * Webform module fieldset component.
   7   */
   8  
   9  /**
  10   * Implementation of _webform_defaults_component().
  11   */
  12  function _webform_defaults_fieldset() {
  13    return array(
  14      'name' => '',
  15      'form_key' => NULL,
  16      'pid' => 0,
  17      'weight' => 0,
  18      'extra' => array(
  19        'title_display' => 0,
  20        'collapsible' => 0,
  21        'collapsed' => 0,
  22        'description' => '',
  23      ),
  24    );
  25  }
  26  
  27  /**
  28   * Implementation of _webform_edit_component().
  29   */
  30  function _webform_edit_fieldset($component) {
  31    $form = array();
  32    $form['display']['collapsible'] = array(
  33      '#type' => 'checkbox',
  34      '#title' => t('Collapsible'),
  35      '#default_value' => $component['extra']['collapsible'],
  36      '#description' => t('If this fieldset is collapsible, the user may open or close the fieldset.'),
  37      '#weight' => 0,
  38      '#parents' => array('extra', 'collapsible'),
  39    );
  40    $form['display']['collapsed'] = array(
  41      '#type' => 'checkbox',
  42      '#title' => t('Collapsed by Default'),
  43      '#default_value' => $component['extra']['collapsed'],
  44      '#description' => t('Collapsible fieldsets are "open" by default. Select this option to default the fieldset to "closed."'),
  45      '#weight' => 3,
  46      '#parents' => array('extra', 'collapsed'),
  47    );
  48    return $form;
  49  }
  50  
  51  /**
  52   * Implementation of _webform_render_component().
  53   */
  54  function _webform_render_fieldset($component, $value = NULL, $filter = TRUE) {
  55    $element = array(
  56      '#type' => $component['type'],
  57      '#title' => $filter ? _webform_filter_xss($component['name']) : $component['name'],
  58      '#title_display' => $component['extra']['title_display'] ? $component['extra']['title_display'] : NULL,
  59      '#weight' => $component['weight'],
  60      '#description' => $filter ? _webform_filter_descriptions($component['extra']['description']) : $component['extra']['description'],
  61      '#collapsible' => $component['extra']['collapsible'],
  62      '#collapsed' => $component['extra']['collapsed'],
  63      '#attributes' => array('class' => 'webform-component-' . $component['type'], 'id' => 'webform-component-' . $component['form_key']),
  64      '#pre_render' => array('webform_element_title_display'),
  65      '#webform_component' => $component,
  66    );
  67  
  68    return $element;
  69  }
  70  
  71  /**
  72   * Implementation of _webform_display_component().
  73   */
  74  function _webform_display_fieldset($component, $value, $format = 'html') {
  75    if ($format == 'text') {
  76      $element = array(
  77        '#title' => $component['name'],
  78        '#weight' => $component['weight'],
  79        '#post_render' => array('webform_element_wrapper'),
  80        '#theme_wrappers' => array('webform_element_text'),
  81      );
  82    }
  83    else {
  84      $element = _webform_render_fieldset($component, $value);
  85    }
  86  
  87    $element['#webform_component'] = $component;
  88    $element['#format'] = $format;
  89  
  90    return $element;
  91  }


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