Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Commits
f678e370
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
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
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