PanelizerWizardContextDeleteForm.php in Panelizer 8.5
File
src/Form/PanelizerWizardContextDeleteForm.php
View source
<?php
namespace Drupal\panelizer\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\ctools\Form\ContextDelete;
class PanelizerWizardContextDeleteForm extends ContextDelete {
public function getFormId() {
return 'panelizer_wizard_context_delete_form';
}
public function getQuestion() {
$cached_values = $this
->getTempstore();
$context = $cached_values['contexts'][$this->context_id];
return $this
->t('Are you sure you want to delete the context @label?', [
'@label' => $context['label'],
]);
}
public function getCancelUrl() {
$cached_values = $this
->getTempstore();
return new Url('panelizer.wizard.add.step', [
'machine_name' => $cached_values['id'],
'step' => 'contexts',
]);
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$cached_values = $this
->getTempstore();
$context = $cached_values['contexts'][$this->context_id];
\Drupal::messenger()
->addMessage($this
->t('The static context %label has been removed.', [
'%label' => $context['label'],
]));
unset($cached_values['contexts'][$this->context_id]);
$this
->setTempstore($cached_values);
parent::submitForm($form, $form_state);
}
}