[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @file
   5   * Webform module page break component.
   6   */
   7  
   8  /**
   9   * Implements _webform_defaults_component().
  10   */
  11  function _webform_defaults_pagebreak() {
  12    return array(
  13      'name' => '',
  14      'form_key' => NULL,
  15      'pid' => 0,
  16      'weight' => 0,
  17      'extra' => array(
  18        'private' => FALSE,
  19        'next_page_label' => '',
  20        'prev_page_label' => '',
  21      ),
  22    );
  23  }
  24  
  25  /**
  26   * Implements _webform_theme_component().
  27   */
  28  function _webform_theme_pagebreak() {
  29    return array(
  30      'webform_display_pagebreak' => array(
  31        'arguments' => array('element' => NULL),
  32        'file' => 'components/pagebreak.inc',
  33      ),
  34    );
  35  }
  36  
  37  /**
  38   * Implements _webform_edit_component().
  39   */
  40  function _webform_edit_pagebreak($component) {
  41    $form = array();
  42    // Force the parent to always be root.
  43    $form['position']['pid'] = array(
  44      '#type' => 'hidden',
  45      '#value' => '0',
  46    );
  47  
  48    $form['display'] = array('#type' => 'markup'); // Hide the display options.
  49  
  50    $form['extra']['next_page_label'] = array(
  51      '#type' => 'textfield',
  52      '#title' => t('Next page button label'),
  53      '#description' => t('This is used for the <em>Next Page</em> button on the page before this page break. Default: <em>Next Page &gt;</em>'),
  54      '#default_value' => $component['extra']['next_page_label'],
  55      '#size' => 30,
  56    );
  57    $form['extra']['prev_page_label'] = array(
  58      '#type' => 'textfield',
  59      '#title' => t('Prev page button label'),
  60      '#description' => t('This is used for the <em>Prev Page</em> button on the page after this page break. Default: <em>&lt; Prev Page</em>'),
  61      '#default_value' => $component['extra']['prev_page_label'],
  62      '#size' => 30,
  63    );
  64  
  65    return $form;
  66  }
  67  
  68  /**
  69   * Implements _webform_render_component().
  70   */
  71  function _webform_render_pagebreak($component, $value = NULL, $filter = TRUE) {
  72    $element = array(
  73      '#type' => 'hidden',
  74      '#value' => $component['name'],
  75      '#weight' => $component['weight'],
  76    );
  77    return $element;
  78  }
  79  
  80  /**
  81   * Implements _webform_render_component().
  82   */
  83  function _webform_display_pagebreak($component, $value = NULL, $format = 'html') {
  84    $element = array(
  85      '#theme' => 'webform_display_pagebreak',
  86      '#title' => $component['name'],
  87      '#weight' => $component['weight'],
  88      '#format' => $format,
  89      '#translatable' => array('title'),
  90    );
  91    return $element;
  92  }
  93  
  94  /**
  95   * Format the text output data for this component.
  96   */
  97  function theme_webform_display_pagebreak($element) {
  98    return $element['#format'] == 'html' ? '<h2 class="webform-page">' . check_plain($element['#title']) . '</h2>' : "--" . $element['#title'] . "--\n";
  99  }


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