public function ConditionalFieldsFormHelper::getEffect in Conditional Fields 4.x
Same name and namespace in other branches
- 8 src/ConditionalFieldsFormHelper.php \Drupal\conditional_fields\ConditionalFieldsFormHelper::getEffect()
Returns js effect for field.
Parameters
array $options: Field CF settings.
Return value
array Effect with options.
1 call to ConditionalFieldsFormHelper::getEffect()
- ConditionalFieldsFormHelper::processDependeeFields in src/
ConditionalFieldsFormHelper.php - Determine and register dependee field effects.
File
- src/
ConditionalFieldsFormHelper.php, line 346
Class
- ConditionalFieldsFormHelper
- Helper to interact with forms.
Namespace
Drupal\conditional_fieldsCode
public function getEffect(array $options) {
// Build effect settings for effects with options.
// @todo add dependee key to allow different effects on the same selector.
if ($options['effect'] && $options['effect'] != 'show') {
// Convert numeric strings to numbers.
foreach ($options['effect_options'] as &$effect_option) {
if (is_numeric($effect_option)) {
$effect_option += 0;
}
}
return [
'effect' => $options['effect'],
'options' => $options['effect_options'],
];
}
return [];
}