Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443205
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
drupal-3443205
Commits
f678e370
"README.md" did not exist on "97eb1cf1e465101622b11ecce798005a2724f2cb"
Commit
f678e370
authored
9 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2536456
by mbovan, Berdir, Wim Leers, dawehner: Autocomplete is broken...
Issue
#2536456
by mbovan, Berdir, Wim Leers, dawehner: Autocomplete is broken (its JS it not loaded)
parent
e8e883f9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/lib/Drupal/Core/Render/Element/FormElement.php
+2
-2
2 additions, 2 deletions
core/lib/Drupal/Core/Render/Element/FormElement.php
core/modules/system/src/Tests/Form/ElementTest.php
+3
-0
3 additions, 0 deletions
core/modules/system/src/Tests/Form/ElementTest.php
with
5 additions
and
2 deletions
core/lib/Drupal/Core/Render/Element/FormElement.php
+
2
−
2
View file @
f678e370
...
...
@@ -128,10 +128,10 @@ public static function processAutocomplete(&$element, FormStateInterface $form_s
$metadata
=
BubbleableMetadata
::
createFromRenderArray
(
$element
);
if
(
$access
->
isAllowed
())
{
$element
[
'#attributes'
][
'class'
][]
=
'form-autocomplete'
;
$
element
[
'#attached'
]
[
'library'
][]
=
'core/drupal.autocomplete'
;
$
metadata
->
addAttachments
(
[
'library'
=>
[
'core/drupal.autocomplete'
]])
;
// Provide a data attribute for the JavaScript behavior to bind to.
$element
[
'#attributes'
][
'data-autocomplete-path'
]
=
$url
->
getGeneratedUrl
();
$metadata
->
merge
(
$url
);
$metadata
=
$metadata
->
merge
(
$url
);
}
$metadata
->
merge
(
BubbleableMetadata
::
createFromObject
(
$access
))
...
...
This diff is collapsed.
Click to expand it.
core/modules/system/src/Tests/Form/ElementTest.php
+
3
−
0
View file @
f678e370
...
...
@@ -151,6 +151,9 @@ public function testFormAutocomplete() {
$this
->
drupalLogin
(
$user
);
$this
->
drupalGet
(
'form-test/autocomplete'
);
// Make sure that the autocomplete library is added.
$this
->
assertRaw
(
'core/misc/autocomplete.js'
);
$result
=
$this
->
xpath
(
'//input[@id="edit-autocomplete-1" and contains(@data-autocomplete-path, "form-test/autocomplete-1")]'
);
$this
->
assertEqual
(
count
(
$result
),
1
,
'Ensure that the user does have access to the autocompletion'
);
$result
=
$this
->
xpath
(
'//input[@id="edit-autocomplete-2" and contains(@data-autocomplete-path, "form-test/autocomplete-2/value")]'
);
...
...
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