ExampleConfigEntityExternalForm.php in Chaos Tool Suite (ctools) 8.3
File
tests/modules/ctools_wizard_test/src/Form/ExampleConfigEntityExternalForm.php
View source
<?php
namespace Drupal\ctools_wizard_test\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\TempStore\SharedTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ExampleConfigEntityExternalForm extends FormBase {
protected $tempstore;
public function __construct(SharedTempStoreFactory $tempstore) {
$this->tempstore = $tempstore;
}
public static function create(ContainerInterface $container) {
return new static($container
->get('tempstore.shared'));
}
public function getFormId() {
return 'ctools_wizard_test_example_config_entity_external_form';
}
public function buildForm(array $form, FormStateInterface $form_state, $machine_name = '') {
$cached_values = $this->tempstore
->get('ctools_wizard_test.config_entity')
->get($machine_name);
$config_entity = $cached_values['ctools_wizard_test_config_entity'];
$form['blah'] = [
'#markup' => 'Value from one: ' . $config_entity
->getOne(),
];
return $form;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}