public function CalculateValue::getSettingsForm in Business Rules 2.x
Same name and namespace in other branches
- 8 src/Plugin/BusinessRulesAction/CalculateValue.php \Drupal\business_rules\Plugin\BusinessRulesAction\CalculateValue::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/ CalculateValue.php, line 33
Class
- CalculateValue
- Class CalculateValue.
Namespace
Drupal\business_rules\Plugin\BusinessRulesActionCode
public function getSettingsForm(array &$form, FormStateInterface $form_state, ItemInterface $item) {
$settings['variable'] = [
'#type' => 'select',
'#title' => t('Variable to store the result'),
'#options' => $this->util
->getVariablesOptions([
'custom_value_variable',
]),
'#default_value' => $item
->getSettings('variable'),
'#required' => TRUE,
'#description' => t('The variable to store the value. Only variables type "Custom value" are allowed.'),
];
$settings['formula'] = [
'#type' => 'textarea',
'#title' => t('Formula'),
'#default_value' => $item
->getSettings('formula'),
'#description' => $this
->getFormulaDescription(),
];
return $settings;
}