Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
layout_paragraphs
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
layout_paragraphs
Commits
8158f2d8
Commit
8158f2d8
authored
3 years ago
by
Justin Toupin
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3260241
: Nested Layout Paragraphs modal issues
parent
81af8aac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!103
Issue #3295875: Add a new dedicated permission for Layout paragraphs configurations
,
!73
Issue #3260241: Nested Layout Paragraphs modal issues
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Controller/ChooseComponentController.php
+15
-6
15 additions, 6 deletions
src/Controller/ChooseComponentController.php
tests/src/FunctionalJavascript/BuilderTestBase.php
+6
-0
6 additions, 0 deletions
tests/src/FunctionalJavascript/BuilderTestBase.php
with
21 additions
and
6 deletions
src/Controller/ChooseComponentController.php
+
15
−
6
View file @
8158f2d8
...
...
@@ -3,16 +3,19 @@
namespace
Drupal\layout_paragraphs\Controller
;
use
Drupal\Core\Url
;
use
Drupal\Core\Ajax\AjaxResponse
;
use
Drupal\Core\Template\Attribute
;
use
Drupal\Core\Ajax\AjaxHelperTrait
;
use
Drupal\Core\Ajax\OpenDialogCommand
;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\Core\Entity\EntityTypeBundleInfoInterface
;
use
Drupal\layout_paragraphs
\LayoutParagraphsLayout
;
use
Drupal\layout_paragraphs
\LayoutParagraphsLayoutRefreshTrait
;
use
Drupal\layout_paragraphs
\Event\LayoutParagraphsAllowedTypesEvent
;
use
Drupal\layout_paragraphs
\Utility\Dialog
;
use
Symfony\Component\HttpFoundation\Request
;
use
Drupal\layout_paragraphs
\LayoutParagraphsLayout
;
use
Drupal\Core\Entity\EntityTypeBundleInfoInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\EventDispatcher\EventDispatcherInterface
;
use
Drupal\layout_paragraphs
\LayoutParagraphsLayoutRefreshTrait
;
use
Drupal\layout_paragraphs
\Event\LayoutParagraphsAllowedTypesEvent
;
/**
* ChooseComponentController controller class.
...
...
@@ -91,7 +94,7 @@ class ChooseComponentController extends ControllerBase {
if
(
count
(
$types
)
===
1
)
{
$type_name
=
key
(
$types
);
$type
=
$this
->
entityTypeManager
()
->
getStorage
(
'paragraphs_type'
)
->
load
(
$type_name
);
$
response
=
$this
->
formBuilder
()
->
getForm
(
$
form
=
$this
->
formBuilder
()
->
getForm
(
'\Drupal\layout_paragraphs\Form\InsertComponentForm'
,
$layout_paragraphs_layout
,
$type
,
...
...
@@ -100,7 +103,13 @@ class ChooseComponentController extends ControllerBase {
$query_params
[
'sibling_uuid'
],
$query_params
[
'placement'
]
);
return
$response
;
if
(
$this
->
isAjax
())
{
$response
=
new
AjaxResponse
();
$selector
=
Dialog
::
dialogSelector
(
$layout_paragraphs_layout
);
$response
->
addCommand
(
new
OpenDialogCommand
(
$selector
,
$form
[
'#title'
],
$form
,
Dialog
::
dialogSettings
()));
return
$response
;
}
return
$form
;
}
foreach
(
$types
as
&
$type
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/src/FunctionalJavascript/BuilderTestBase.php
+
6
−
0
View file @
8158f2d8
...
...
@@ -123,6 +123,12 @@ abstract class BuilderTestBase extends WebDriverTestBase {
$this
->
assertSession
()
->
assertWaitOnAjaxRequest
();
}
$dialog
=
$page
->
find
(
'css'
,
'.lpb-dialog'
);
$style
=
$dialog
->
getAttribute
(
'style'
);
if
(
strpos
(
$style
,
'width: 90%;'
)
===
FALSE
||
strpos
(
$style
,
'height: auto;'
)
===
FALSE
)
{
throw
new
ExpectationException
(
'Incorrect dialog width or height settings'
,
$this
->
getSession
()
->
getDriver
());
}
$this
->
assertSession
()
->
pageTextContains
(
'field_text'
);
$page
->
fillField
(
'field_text[0][value]'
,
$text
);
...
...
This diff is collapsed.
Click to expand it.
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