You are here

function feeds_tamper_convert_boolean_form in Feeds Tamper 7

Same name and namespace in other branches
  1. 6 plugins/convert_boolean.inc \feeds_tamper_convert_boolean_form()
1 string reference to 'feeds_tamper_convert_boolean_form'
convert_boolean.inc in plugins/convert_boolean.inc

File

plugins/convert_boolean.inc, line 17

Code

function feeds_tamper_convert_boolean_form($importer, $element_key, $settings) {
  $form = array();
  $form['true_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Truth value'),
    '#default_value' => isset($settings['true_value']) ? $settings['true_value'] : 'true',
  );
  $form['false_value'] = array(
    '#type' => 'textfield',
    '#title' => t('False value'),
    '#default_value' => isset($settings['false_value']) ? $settings['false_value'] : 'false',
  );
  $form['match_case'] = array(
    '#type' => 'checkbox',
    '#title' => t('Match case'),
    '#default_value' => isset($settings['match_case']) ? $settings['match_case'] : FALSE,
  );
  $form['no_match'] = array(
    '#type' => 'radios',
    '#title' => t('If no match'),
    '#default_value' => isset($settings['no_match']) ? $settings['no_match'] : 'false',
    '#options' => array(
      'true' => 'True',
      'false' => t('False'),
      'null' => t('Null'),
      'pass' => t('Do not modify'),
      'other' => t('Other'),
    ),
    '#description' => t('The value to set if the true and false values do not match.'),
  );
  $form['other_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Other text'),
    '#default_value' => isset($settings['other_text']) ? $settings['other_text'] : '',
    '#states' => array(
      'visible' => array(
        'input[name="settings[no_match]"]' => array(
          'value' => 'other',
        ),
      ),
    ),
  );
  return $form;
}