Skip to content
Snippets Groups Projects

Issue #3352714: Make Ajax response alterable from Layout Paragraphs operations

12 files
+ 247
33
Compare changes
  • Side-by-side
  • Inline
Files
12
@@ -8,6 +8,8 @@ use Drupal\Core\Template\Attribute;
use Drupal\Core\Ajax\AjaxHelperTrait;
use Drupal\Core\Ajax\OpenDialogCommand;
use Drupal\Core\Controller\ControllerBase;
use Drupal\layout_paragraphs\Event\LayoutParagraphsAjaxResponseEvent;
use Drupal\layout_paragraphs\Event\LayoutParagraphsAjaxResponseEvents;
use Drupal\layout_paragraphs\Utility\Dialog;
use Symfony\Component\HttpFoundation\Request;
use Drupal\layout_paragraphs\LayoutParagraphsLayout;
@@ -139,6 +141,8 @@ class ChooseComponentController extends ControllerBase {
$response = new AjaxResponse();
$selector = Dialog::dialogSelector($layout_paragraphs_layout);
$response->addCommand(new OpenDialogCommand($selector, $form['#title'], $form, Dialog::dialogSettings()));
$this->eventDispatcher->dispatch(new LayoutParagraphsAjaxResponseEvent($response), LayoutParagraphsAjaxResponseEvents::COMPONENT_FORM_CHOOSE);
$this->eventDispatcher->dispatch(new LayoutParagraphsAjaxResponseEvent($response), LayoutParagraphsAjaxResponseEvents::LAYOUT_PARAGRAPH);
return $response;
}
return $form;
Loading