protected function ChangeFieldInfo::changeFieldInfo in Business Rules 8
Same name and namespace in other branches
- 2.x src/Plugin/BusinessRulesAction/ChangeFieldInfo.php \Drupal\business_rules\Plugin\BusinessRulesAction\ChangeFieldInfo::changeFieldInfo()
Change info at the form array.
1 call to ChangeFieldInfo::changeFieldInfo()
- ChangeFieldInfo::execute in src/
Plugin/ BusinessRulesAction/ ChangeFieldInfo.php - Execute the action.
File
- src/
Plugin/ BusinessRulesAction/ ChangeFieldInfo.php, line 353
Class
- ChangeFieldInfo
- Class ChangeFieldInfo.
Namespace
Drupal\business_rules\Plugin\BusinessRulesActionCode
protected function changeFieldInfo(array &$element, $action_field) {
switch ($action_field['action']) {
case self::MAKE_REQUIRED:
$element['#required'] = TRUE;
if (isset($element[0])) {
$element[0]['#required'] = TRUE;
}
if (isset($element['target_id'])) {
$element['target_id']['#required'] = TRUE;
}
break;
case self::MAKE_OPTIONAL:
$element['#required'] = FALSE;
if (isset($element[0])) {
$element[0]['#required'] = FALSE;
}
if (isset($element['target_id'])) {
$element['target_id']['#required'] = FALSE;
}
break;
case self::MAKE_READ_ONLY:
$element['#disabled'] = TRUE;
break;
case self::MAKE_HIDDEN:
$element = [];
break;
}
}