Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / settings_tray / tests / modules / settings_tray_test / src / Plugin / Block / ValidationErrorBlock.php
1 <?php
2
3 namespace Drupal\settings_tray_test\Plugin\Block;
4
5 use Drupal\Core\Block\BlockBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Provides a 'Block with validation error' test block.
10  *
11  * @Block(
12  *   id = "settings_tray_test_validation",
13  *   admin_label = @Translation("Block with validation error")
14  * )
15  */
16 class ValidationErrorBlock extends BlockBase {
17
18   /**
19    * {@inheritdoc}
20    */
21   public function build() {
22     return ['#markup' => '<span>If I had more time this would be very witty :(.</span>'];
23   }
24
25   /**
26    * {@inheritdoc}
27    */
28   public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
29     parent::validateConfigurationForm($form, $form_state);
30     $form_state->setError($form['label'], 'Sorry system error. Please save again.');
31   }
32
33 }