ComplexTestTypeStateForm.php in Drupal 8
File
core/modules/workflows/tests/modules/workflow_type_test/src/Form/ComplexTestTypeStateForm.php
View source
<?php
namespace Drupal\workflow_type_test\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\workflows\Plugin\WorkflowTypeStateFormBase;
class ComplexTestTypeStateForm extends WorkflowTypeStateFormBase {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$state = $form_state
->get('state');
$configuration = $this->workflowType
->getConfiguration();
$form['extra'] = [
'#type' => 'textfield',
'#title' => $this
->t('Extra'),
'#description' => $this
->t('Extra information added to state'),
'#default_value' => $state && isset($configuration['states'][$state
->id()]['extra']) ? $configuration['states'][$state
->id()]['extra'] : '',
];
return $form;
}
}