X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fmodules%2Fajax_forms_test%2Fsrc%2FPlugin%2FBlock%2FAjaxFormBlock.php;h=65e1372d999f0fc9d47131a1841a6519cd81fdab;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=aa50cc4658c0424536f756845040a6e304d4b35a;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php b/web/core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php index aa50cc465..65e1372d9 100644 --- a/web/core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php +++ b/web/core/modules/system/tests/modules/ajax_forms_test/src/Plugin/Block/AjaxFormBlock.php @@ -6,6 +6,7 @@ use Drupal\Core\Block\BlockBase; use Drupal\Core\Form\FormBuilderInterface; use Drupal\Core\Form\FormInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -27,6 +28,13 @@ class AjaxFormBlock extends BlockBase implements FormInterface, ContainerFactory */ protected $formBuilder; + /** + * The messenger. + * + * @var \Drupal\Core\Messenger\MessengerInterface + */ + protected $messenger; + /** * Constructs a new AjaxFormBlock. * @@ -38,10 +46,13 @@ class AjaxFormBlock extends BlockBase implements FormInterface, ContainerFactory * The plugin implementation definition. * @param \Drupal\Core\Form\FormBuilderInterface $form_builder * The form builder. + * @param \Drupal\Core\Messenger\MessengerInterface $messenger + * The messenger. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, FormBuilderInterface $form_builder) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, FormBuilderInterface $form_builder, MessengerInterface $messenger) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->formBuilder = $form_builder; + $this->messenger = $messenger; } /** @@ -52,7 +63,8 @@ class AjaxFormBlock extends BlockBase implements FormInterface, ContainerFactory $configuration, $plugin_id, $plugin_definition, - $container->get('form_builder') + $container->get('form_builder'), + $container->get('messenger') ); } @@ -129,7 +141,7 @@ class AjaxFormBlock extends BlockBase implements FormInterface, ContainerFactory * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { - drupal_set_message('Submission successful.'); + $this->messenger->addStatus('Submission successful.'); } }