You are here

function conditional_fields_conditions in Conditional Fields 7.3

List of states of a dependee field that may be used to evaluate a condition.

3 calls to conditional_fields_conditions()
conditional_fields_dependency_add_form in includes/conditional_fields.admin.inc
Dependency add form.
conditional_fields_dependency_description in ./conditional_fields.module
Build a textual description of a dependency
conditional_fields_dependency_edit_form in includes/conditional_fields.admin.inc
Dependency edit form.

File

./conditional_fields.module, line 1596
Define dependencies between fields based on their states and values.

Code

function conditional_fields_conditions($checkboxes = TRUE) {

  // Supported by States API
  $conditions = array(
    '!empty' => t('Filled'),
    'empty' => t('Empty'),
    'touched' => t('Touched'),
    '!touched' => t('Untouched'),
    'focused' => t('Focused'),
    '!focused' => t('Unfocused'),
  );
  if ($checkboxes) {

    // Relevant only if dependee is a list of checkboxes
    $conditions['checked'] = t('Checked');
    $conditions['!checked'] = t('Unchecked');
  }
  $conditions['value'] = t('Value');

  // TODO: Add support from Conditional Fields to these conditions

  /*
  '!disabled'  => t('Enabled'),
  'disabled'   => t('Disabled'),
  'required'   => t('Required'),
  '!required'  => t('Optional'),
  'relevant'   => t('Relevant'),
  '!relevant'  => t('Irrelevant'),
  'valid'      => t('Valid'),
  '!valid'     => t('Invalid'),
  '!readonly'  => t('Read/Write'),
  'readonly'   => t('Read Only'),
  '!collapsed' => t('Expanded'),
  'collapsed'  => t('Collapsed'),
  */

  // Allow other modules to modify the conditions
  drupal_alter('conditional_fields_conditions', $conditions);
  return $conditions;
}