Advertisement
Guest User

Untitled

a guest
May 26th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. function webform_components_form($form, $form_state, $node) {
  2.   $form = array(
  3.     '#tree' => TRUE,
  4.     '#node' => $node,
  5.     'components' => array(),
  6.   );
  7.  
  8.   $form['nid'] = array(
  9.     '#type' => 'value',
  10.     '#value' => $node->nid,
  11.   );
  12.  
  13.   $options = array();
  14.   foreach ($node->webform['components'] as $cid => $component) { //  <-- 56. sor
  15.     $options[$cid] = check_plain($component['name']);
  16.     $form['components'][$cid]['cid'] = array(
  17.       '#type' => 'hidden',
  18.       '#default_value' => $component['cid'],
  19.     );
  20.     $form['components'][$cid]['pid'] = array(
  21.       '#type' => 'hidden',
  22.       '#default_value' => $component['pid'],
  23.     );
  24.     $form['components'][$cid]['weight'] = array(
  25.       '#type' => 'textfield',
  26.       '#size' => 4,
  27.       '#title' => t('Weight'),
  28.       '#default_value' => $component['weight'],
  29.     );
  30.     $form['components'][$cid]['mandatory'] = array(
  31.       '#type' => 'checkbox',
  32.       '#title' => t('Mandatory'),
  33.       '#default_value' => $component['mandatory'],
  34.       '#access' => webform_component_feature($component['type'], 'required'),
  35.     );
  36.     if (!isset($max_weight) || $component['weight'] > $max_weight) {
  37.       $max_weight = $component['weight'];
  38.     }
  39.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement