X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fctools%2Fsrc%2FForm%2FContextDelete.php;fp=web%2Fmodules%2Fcontrib%2Fctools%2Fsrc%2FForm%2FContextDelete.php;h=06e0794a86fb2122fe270591c687b74ae7d6cdef;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/ctools/src/Form/ContextDelete.php b/web/modules/contrib/ctools/src/Form/ContextDelete.php new file mode 100644 index 000000000..06e0794a8 --- /dev/null +++ b/web/modules/contrib/ctools/src/Form/ContextDelete.php @@ -0,0 +1,85 @@ +get('user.shared_tempstore')); + } + + public function __construct(SharedTempStoreFactory $tempstore) { + $this->tempstore = $tempstore; + } + + /** + * {@inheritdoc} + */ + public function getFormId() { + return 'ctools_context_delete_form'; + } + + /** + * {@inheritdoc} + */ + public function getConfirmText() { + return $this->t('Delete'); + } + + /** + * {@inheritdoc} + */ + public function buildForm(array $form, FormStateInterface $form_state, $tempstore_id = NULL, $machine_name = NULL, $context_id = NULL) { + $this->tempstore_id = $tempstore_id; + $this->machine_name = $machine_name; + $this->context_id = $context_id; + return parent::buildForm($form, $form_state); + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $form_state->setRedirectUrl($this->getCancelUrl()); + } + + protected function getTempstore() { + return $this->tempstore->get($this->tempstore_id)->get($this->machine_name); + } + + protected function setTempstore($cached_values) { + $this->tempstore->get($this->tempstore_id)->set($this->machine_name, $cached_values); + } + +}