Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
eca
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
eca
Commits
51f6c36b
Commit
51f6c36b
authored
6 months ago
by
Jürgen Haas
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3471271
by jurgenhaas, danielspeicher: ECA Endpoint: Ajax Requests do not receive messages
parent
cea9178b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!447
Issue #3471271 by jurgenhaas: ECA Endpoint: Ajax Requests do not receive messages
Pipeline
#272463
passed
6 months ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/endpoint/src/Controller/EndpointController.php
+21
-2
21 additions, 2 deletions
modules/endpoint/src/Controller/EndpointController.php
with
21 additions
and
2 deletions
modules/endpoint/src/Controller/EndpointController.php
+
21
−
2
View file @
51f6c36b
...
...
@@ -6,11 +6,13 @@ use Drupal\Core\Access\AccessResult;
use
Drupal\Core\Access\AccessResultInterface
;
use
Drupal\Core\Ajax\AjaxHelperTrait
;
use
Drupal\Core\Ajax\AjaxResponse
;
use
Drupal\Core\Ajax\MessageCommand
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Datetime\DrupalDateTime
;
use
Drupal\Core\DependencyInjection\ContainerInjectionInterface
;
use
Drupal\Core\Logger\LoggerChannelInterface
;
use
Drupal\Core\Logger\RfcLogLevel
;
use
Drupal\Core\Messenger\MessengerInterface
;
use
Drupal\Core\Render\BubbleableMetadata
;
use
Drupal\Core\Render\Element
;
use
Drupal\Core\Render\MainContent\HtmlRenderer
;
...
...
@@ -83,6 +85,13 @@ final class EndpointController implements ContainerInjectionInterface {
*/
protected
LoggerChannelInterface
$logger
;
/**
* The messenger.
*
* @var \Drupal\Core\Messenger\MessengerInterface
*/
protected
MessengerInterface
$messenger
;
/**
* {@inheritdoc}
*/
...
...
@@ -94,7 +103,8 @@ final class EndpointController implements ContainerInjectionInterface {
$container
->
get
(
'current_route_match'
),
$container
->
get
(
'current_user'
),
$container
->
get
(
'config.factory'
),
$container
->
get
(
'logger.channel.eca'
)
$container
->
get
(
'logger.channel.eca'
),
$container
->
get
(
'messenger'
)
);
}
...
...
@@ -115,8 +125,10 @@ final class EndpointController implements ContainerInjectionInterface {
* The config factory.
* @param \Drupal\Core\Logger\LoggerChannelInterface $logger
* The logger.
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
* The messenger.
*/
public
function
__construct
(
TriggerEvent
$trigger_event
,
RendererInterface
$renderer
,
HtmlRenderer
$html_renderer
,
RouteMatchInterface
$route_match
,
AccountInterface
$current_user
,
ConfigFactoryInterface
$config_factory
,
LoggerChannelInterface
$logger
)
{
public
function
__construct
(
TriggerEvent
$trigger_event
,
RendererInterface
$renderer
,
HtmlRenderer
$html_renderer
,
RouteMatchInterface
$route_match
,
AccountInterface
$current_user
,
ConfigFactoryInterface
$config_factory
,
LoggerChannelInterface
$logger
,
MessengerInterface
$messenger
)
{
$this
->
triggerEvent
=
$trigger_event
;
$this
->
renderer
=
$renderer
;
$this
->
mainContentHtmlRenderer
=
$html_renderer
;
...
...
@@ -124,6 +136,7 @@ final class EndpointController implements ContainerInjectionInterface {
$this
->
currentUser
=
$current_user
;
$this
->
configFactory
=
$config_factory
;
$this
->
logger
=
$logger
;
$this
->
messenger
=
$messenger
;
}
/**
...
...
@@ -189,6 +202,12 @@ final class EndpointController implements ContainerInjectionInterface {
$event
=
$this
->
triggerEvent
->
dispatchFromPlugin
(
'eca_endpoint:response'
,
$path_arguments
,
$request
,
$response
,
$account
,
$build
);
if
(
$response
instanceof
AjaxResponse
)
{
foreach
(
$this
->
messenger
->
deleteAll
()
as
$type
=>
$type_messages
)
{
/** @var string[]|\Drupal\Component\Render\MarkupInterface[] $type_messages */
foreach
(
$type_messages
as
$message
)
{
$response
->
addCommand
(
new
MessageCommand
((
string
)
$message
,
NULL
,
[
'type'
=>
$type
],
FALSE
));
}
}
return
$response
;
}
if
(
$event
instanceof
RenderEventInterface
)
{
...
...
This diff is collapsed.
Click to expand it.
Jürgen Haas
@jurgenhaas
mentioned in commit
b3e35c9e
·
6 months ago
mentioned in commit
b3e35c9e
mentioned in commit b3e35c9e4e1a6e2c940411e2df53059158b81cd1
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment