class WorkflowTypeConfigureForm in Workflows Field 2.x
Same name and namespace in other branches
- 8 src/Form/WorkflowTypeConfigureForm.php \Drupal\workflows_field\Form\WorkflowTypeConfigureForm
Plugin form for the workflows field.
Hierarchy
- class \Drupal\workflows\Plugin\WorkflowTypeConfigureFormBase implements PluginAwareInterface, PluginFormInterface uses StringTranslationTrait
- class \Drupal\workflows_field\Form\WorkflowTypeConfigureForm
Expanded class hierarchy of WorkflowTypeConfigureForm
File
- src/
Form/ WorkflowTypeConfigureForm.php, line 12
Namespace
Drupal\workflows_field\FormView source
class WorkflowTypeConfigureForm extends WorkflowTypeConfigureFormBase {
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$configuration = $this->workflowType
->getConfiguration();
$form['settings'] = [
'#title' => $this
->t('Workflow Settings'),
'#type' => 'fieldset',
];
$labels = array_map([
State::class,
'labelCallback',
], $this->workflowType
->getStates());
$form['settings']['initial_state'] = [
'#title' => $this
->t('Initial State'),
'#type' => 'select',
'#default_value' => isset($configuration['initial_state']) ? $configuration['initial_state'] : NULL,
'#options' => $labels,
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$configuration = $this->workflowType
->getConfiguration();
$configuration['initial_state'] = $form_state
->getValue([
'settings',
'initial_state',
]);
$this->workflowType
->setConfiguration($configuration);
}
}