public function ChangeFieldInfo::getSettingsForm in Business Rules 8
Same name and namespace in other branches
- 2.x src/Plugin/BusinessRulesAction/ChangeFieldInfo.php \Drupal\business_rules\Plugin\BusinessRulesAction\ChangeFieldInfo::getSettingsForm()
Return the form array.
@internal param array $form
Parameters
array $form: The form array.
\Drupal\Core\Form\FormStateInterface $form_state: The form state object.
\Drupal\business_rules\ItemInterface $item: The configured item.
Return value
array The render array for the settings form.
Overrides BusinessRulesItemPluginBase::getSettingsForm
File
- src/
Plugin/ BusinessRulesAction/ ChangeFieldInfo.php, line 138
Class
- ChangeFieldInfo
- Class ChangeFieldInfo.
Namespace
Drupal\business_rules\Plugin\BusinessRulesActionCode
public function getSettingsForm(array &$form, FormStateInterface $form_state, ItemInterface $item) {
if ($item
->isNew()) {
return [];
}
$form_state
->set('action', $item);
$settings['fields'] = [
'#type' => 'table',
'#header' => [
'field' => t('Filed'),
'action' => t('Action'),
'operations' => t('Operations'),
],
'#attributes' => [
'id' => 'array_variable_fields_table',
],
];
$settings['info'] = [
'#type' => 'markup',
'#markup' => t('Multiple value fields cannot be changed to be Required or Optional by this module. Create a new rule as "Entity form validation" to achieve this purpose see this issue on https://www.drupal.org/node/1592814.
<br>Hidden fields are removed from the form array, and not rendered. So be careful if you hide a required field because some field widgets can validate it anyway.'),
];
$this
->getRows($item, $settings['fields']);
return $settings;
}