3 namespace Drupal\settings_tray_test\Plugin\Block;
5 use Drupal\Core\Block\BlockBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Provides a 'Block with validation error' test block.
12 * id = "settings_tray_test_validation",
13 * admin_label = @Translation("Block with validation error")
16 class ValidationErrorBlock extends BlockBase {
21 public function build() {
22 return ['#markup' => '<span>If I had more time this would be very witty :(.</span>'];
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.');