Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
310
Merge Requests
310
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
29b0e1b7
Commit
29b0e1b7
authored
Nov 05, 2013
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1589176
by nod_, Wim Leers: Follow-up: Use data-* to store #states api informations.
parent
b6ec2ac4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
core/includes/common.inc
core/includes/common.inc
+6
-1
No files found.
core/includes/common.inc
View file @
29b0e1b7
...
...
@@ -2715,7 +2715,12 @@ function drupal_process_attached($elements, $dependency_check = FALSE) {
*/
function
drupal_process_states
(
&
$elements
)
{
$elements
[
'#attached'
][
'library'
][]
=
array
(
'system'
,
'drupal.states'
);
$elements
[
'#attributes'
][
'data-drupal-states'
]
=
JSON
::
encode
(
$elements
[
'#states'
]);
// Elements of '#type' => 'item' are not actual form input elements, but we
// still want to be able to show/hide them. Since there's no actual HTML input
// element available, setting #attributes does not make sense, but a wrapper
// is available, so setting #wrapper_attributes makes it work.
$key
=
(
$elements
[
'#type'
]
==
'item'
)
?
'#wrapper_attributes'
:
'#attributes'
;
$elements
[
$key
][
'data-drupal-states'
]
=
JSON
::
encode
(
$elements
[
'#states'
]);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment