You are here

drupalgap_webform.module in DrupalGap 7

File

modules/drupalgap_webform/drupalgap_webform.module
View source
<?php

/**
 * Implements hook_form_FORM_ID_alter().
 */
function drupalgap_webform_form_webform_component_edit_form_alter(&$form, &$form_state) {
  if ($form['type']['#value'] != 'select') {
    return;
  }
  $cid = $form['cid']['#value'];

  // Add a checkbox for the DrupalGap hybrid widget.
  $default_value = isset($form['#node']->webform['components'][$cid]['extra']['drupalgap_webform_select_hybrid']) ? $form['#node']->webform['components'][$cid]['extra']['drupalgap_webform_select_hybrid'] : 0;
  $form['extra']['drupalgap_webform_select_hybrid'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use DrupalGap Hybrid Widget'),
    '#description' => t('A hybrid widget for this select component inside the DrupalGap app.'),
    '#default_value' => $default_value,
  );
}