X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fctools%2Ftests%2Fmodules%2Fctools_wizard_test%2Fsrc%2FWizard%2FEntityEditWizardTest.php;fp=web%2Fmodules%2Fcontrib%2Fctools%2Ftests%2Fmodules%2Fctools_wizard_test%2Fsrc%2FWizard%2FEntityEditWizardTest.php;h=b272dfcf2f95ab73f63f9bdcb2d9127c659f5e6c;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/ctools/tests/modules/ctools_wizard_test/src/Wizard/EntityEditWizardTest.php b/web/modules/contrib/ctools/tests/modules/ctools_wizard_test/src/Wizard/EntityEditWizardTest.php new file mode 100644 index 000000000..b272dfcf2 --- /dev/null +++ b/web/modules/contrib/ctools/tests/modules/ctools_wizard_test/src/Wizard/EntityEditWizardTest.php @@ -0,0 +1,71 @@ +t('Example entity'); + } + + /** + * {@inheritdoc} + */ + public function getMachineLabel() { + return $this->t('Label'); + } + + /** + * {@inheritdoc} + */ + public function getEntityType() { + return 'ctools_wizard_test_config_entity'; + } + + /** + * {@inheritdoc} + */ + public function exists() { + return '\Drupal\ctools_wizard_test\Entity\ExampleConfigEntity::load'; + } + + /** + * {@inheritdoc} + */ + public function getOperations($cached_values) { + /** @var $page \Drupal\ctools_wizard_test\Entity\ExampleConfigEntity */ + $config_entity = $cached_values['ctools_wizard_test_config_entity']; + + $steps = [ + 'general' => [ + 'form' => 'Drupal\ctools_wizard_test\Form\ExampleConfigEntityGeneralForm', + 'title' => $this->t('General'), + ], + 'one' => [ + 'form' => 'Drupal\ctools_wizard_test\Form\ExampleConfigEntityOneForm', + 'title' => $this->t('Form One'), + ], + 'two' => [ + 'form' => 'Drupal\ctools_wizard_test\Form\ExampleConfigEntityTwoForm', + 'title' => $this->t('Form Two'), + ], + ]; + + // To test that we can get the config entity and add/remove steps + // based on it's values, we'll add a special step only when the entity + // is pre-existing. + if (!empty($config_entity) && !$config_entity->isNew()) { + $steps['existing'] = [ + 'form' => 'Drupal\ctools_wizard_test\Form\ExampleConfigEntityExistingForm', + 'title' => $this->t('Existing entity'), + ]; + } + + return $steps; + } +}