class ExampleConfigEntityTwoForm
Simple wizard step form.
Hierarchy
- class \Drupal\Core\Form\FormBase extends \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\ctools_wizard_test\Form\ExampleConfigEntityTwoForm implements \Drupal\Core\Form\FormBase
Expanded class hierarchy of ExampleConfigEntityTwoForm
File
-
tests/
modules/ ctools_wizard_test/ src/ Form/ ExampleConfigEntityTwoForm.php, line 11
Namespace
Drupal\ctools_wizard_test\FormView source
class ExampleConfigEntityTwoForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'ctools_wizard_test_config_entity_two_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$cached_values = $form_state->getTemporaryValue('wizard');
/** @var \Drupal\ctools_wizard_test\Entity\ExampleConfigEntity $page */
$config_entity = $cached_values['ctools_wizard_test_config_entity'];
$form['two'] = [
'#title' => $this->t('Two'),
'#type' => 'textfield',
'#default_value' => $config_entity->getTwo() ?: '',
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$cached_values = $form_state->getTemporaryValue('wizard');
/** @var \Drupal\ctools_wizard_test\Entity\ExampleConfigEntity $page */
$config_entity = $cached_values['ctools_wizard_test_config_entity'];
$config_entity->set('two', $form_state->getValue('two'));
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ExampleConfigEntityTwoForm::buildForm | public | function | |
ExampleConfigEntityTwoForm::getFormId | public | function | |
ExampleConfigEntityTwoForm::submitForm | public | function |