diff --git a/src/EventSubscriber/UwCblBlockquoteEventSubscriber.php b/src/EventSubscriber/UwCblBlockquoteEventSubscriber.php index 537992c87f4367acd3e30477fcea72d55c72dec1..5f90c639c17bc4ef331039c4532dddbc461c35af 100644 --- a/src/EventSubscriber/UwCblBlockquoteEventSubscriber.php +++ b/src/EventSubscriber/UwCblBlockquoteEventSubscriber.php @@ -2,9 +2,6 @@ namespace Drupal\uw_custom_blocks\EventSubscriber; -use Drupal\Core\Form\FormStateInterface; -use Drupal\core_event_dispatcher\Event\Form\FormAlterEvent; -use Drupal\core_event_dispatcher\FormHookEvents; use Drupal\preprocess_event_dispatcher\Event\BlockPreprocessEvent; use Drupal\uw_custom_blocks\CustomBlocks\UwCblBase; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -14,53 +11,6 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; */ class UwCblBlockquoteEventSubscriber extends UwCblBase implements EventSubscriberInterface { - /** - * Alter form. - * - * @param \Drupal\core_event_dispatcher\Event\Form\FormAlterEvent $event - * The event. - */ - public function alterForm(FormAlterEvent $event): void { - - if ($this->checkLayoutBuilder($event, 'Blockquote')) { - - // Get the form from the event. - $form = &$event->getForm(); - - // Add the validation for blockquote. - $form['#validate'][] = [$this, 'validateBlockquote']; - } - } - - /** - * Form validation for blockquote. - * - * @param array $form - * The complete form structure. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The form state. - */ - public function validateBlockquote(array &$form, FormStateInterface $form_state) { - - // Get the settings from the form. - $settings = $form_state->getValue('settings', NULL); - - // If there are settings, continue to process. - if ($settings) { - - // If there is a block, continue to process. - if ($block = $settings['block_form']) { - - // If there is no text in the quote text, set error. - if ($block['field_uw_bq_quote_text'][0]['value'] == '') { - - // Set the form error for not having any quote text. - $form_state->setErrorByName('settings][block_form][field_uw_bq_quote_text', 'You must enter quote text.'); - } - } - } - } - /** * Preprocess blocks with blockquote and set variables. * @@ -104,7 +54,6 @@ class UwCblBlockquoteEventSubscriber extends UwCblBase implements EventSubscribe */ public static function getSubscribedEvents() { return [ - FormHookEvents::FORM_ALTER => 'alterForm', BlockPreprocessEvent::name() => 'preprocessBlock', ]; }