public function Conditions::conditionalFieldsStates in Conditional Fields 8
Same name and namespace in other branches
- 4.x src/Conditions.php \Drupal\conditional_fields\Conditions::conditionalFieldsStates()
Builds a list of supported states that may be applied to a dependent field.
File
- src/
Conditions.php, line 56
Class
- Conditions
- Provide conditional field's lists.
Namespace
Drupal\conditional_fieldsCode
public function conditionalFieldsStates() {
$states = [
// Supported by States API.
'visible' => $this
->t('Visible'),
'!visible' => $this
->t('Invisible'),
'!empty' => $this
->t('Filled with a value'),
'empty' => $this
->t('Emptied'),
'!disabled' => $this
->t('Enabled'),
'disabled' => $this
->t('Disabled'),
'checked' => $this
->t('Checked'),
'!checked' => $this
->t('Unchecked'),
'required' => $this
->t('Required'),
'!required' => $this
->t('Optional'),
'!collapsed' => $this
->t('Expanded'),
'collapsed' => $this
->t('Collapsed'),
// Supported by Conditional Fields.
'unchanged' => $this
->t('Unchanged (no state)'),
];
// Allow other modules to modify the states.
$this->moduleHandler
->alter('conditionalFieldsStates', $states);
return $states;
}