You are here

public function ServicesClientPropertyFormatter::configForm in Services Client 7.2

Configuration form options

Overrides ServicesClientMapperPlugin::configForm

File

include/mapping.inc, line 569

Class

ServicesClientPropertyFormatter
Formats data to property.

Code

public function configForm(&$form, &$form_state) {
  $form['formatter_config'] = array(
    '#type' => 'fieldset',
    '#title' => t('Property formatter'),
    '#tree' => TRUE,
  );
  $form['formatter_config']['property'] = array(
    '#type' => 'textfield',
    '#title' => t('Property name'),
    '#description' => t('Enter property name'),
    '#default_value' => $this->config['property'],
  );
  $form['formatter_config']['multivalue'] = array(
    '#type' => 'select',
    '#title' => t('Multiple values'),
    '#description' => t('How to handle multiple values'),
    '#options' => array(
      'force_single' => t('Always force single simple value of property'),
      'force_array' => t('Always send array even with single value'),
    ),
    '#default_value' => $this->config['multivalue'],
  );
  $form['formatter_config']['empty'] = array(
    '#type' => 'select',
    '#title' => t('Empty values'),
    '#description' => t('How to handle empty values'),
    '#options' => array(
      'no_field' => t("Don't create any field"),
      'null_field' => t("Create null field."),
      'default_value' => t('Provide default value'),
    ),
    '#default_value' => $this->config['empty'],
  );
  $form['formatter_config']['default_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Default value'),
    '#description' => t('Provide default value if reader will provide empty value.'),
    '#default_value' => $this->config['default_value'],
    '#states' => array(
      'visible' => array(
        ':input[name="formatter_config[empty]"]' => array(
          array(
            'value' => 'default_value',
          ),
        ),
      ),
    ),
  );
}