You are here

public function ServicesClientFieldCondition::configForm in Services Client 7.2

Configuration form.

Overrides ServicesClientPlugin::configForm

File

include/condition.inc, line 284

Class

ServicesClientFieldCondition

Code

public function configForm(&$form, &$form_state) {
  $form['field'] = array(
    '#type' => 'textfield',
    '#title' => t('Field name'),
    '#required' => TRUE,
    '#description' => t('Enter field name like field_first_name'),
    '#default_value' => isset($this->config['field']) ? $this->config['field'] : NULL,
  );
  $form['language'] = array(
    '#type' => 'textfield',
    '#title' => t('Language'),
    '#required' => TRUE,
    '#description' => t('Enter field language'),
    '#default_value' => isset($this->config['language']) ? $this->config['language'] : LANGUAGE_NONE,
  );
  $form['property'] = array(
    '#type' => 'textfield',
    '#title' => t('Property name'),
    '#required' => TRUE,
    '#description' => t('Enter field property name like "value"'),
    '#default_value' => isset($this->config['property']) ? $this->config['property'] : NULL,
  );
  $form['condition'] = array(
    '#type' => 'select',
    '#title' => t('Condition'),
    '#options' => array(
      'is_empty' => t('Is Empty'),
      'not_empty' => t('Not Empty'),
      'equals' => t('Equals'),
      'not_equals' => t('Not equals'),
    ),
    '#required' => TRUE,
    '#default_value' => isset($this->config['condition']) ? $this->config['condition'] : NULL,
  );
  $form['value'] = array(
    '#type' => 'textfield',
    '#title' => t('Value'),
    '#description' => t('Value that should be tested.'),
    '#default_value' => isset($this->config['value']) ? $this->config['value'] : NULL,
    '#states' => array(
      'invisible' => array(
        ':input[name="condition"]' => array(
          array(
            'value' => 'is_empty',
          ),
          array(
            'value' => 'not_empty',
          ),
        ),
      ),
    ),
  );
}