Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3253715
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-3253715
Commits
2fdeb8fc
Commit
2fdeb8fc
authored
10 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2359561
by metzlerd: Make #attached more prevalent in render api docs.
parent
e775d664
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/system/theme.api.php
+23
-2
23 additions, 2 deletions
core/modules/system/theme.api.php
with
23 additions
and
2 deletions
core/modules/system/theme.api.php
+
23
−
2
View file @
2fdeb8fc
...
...
@@ -200,8 +200,8 @@
* requests and the CSS files used to style that markup. In order to ensure that
* a theme can completely customize the markup, module developers should avoid
* directly writing HTML markup for pages, blocks, and other user-visible output
* in their modules, and instead return structured "render arrays" (see
@ref
* arrays below). Doing this also increases usability, by ensuring that the
* in their modules, and instead return structured "render arrays" (see
*
@ref
arrays below). Doing this also increases usability, by ensuring that the
* markup used for similar functionality on different areas of the site is the
* same, which gives users fewer user interface patterns to learn.
*
...
...
@@ -258,6 +258,9 @@
* normally preferable to use #theme or #type instead, so that the theme can
* customize the markup.
*
* JavaScript and CSS attributes are specified in the render array using the
* #attached property (see @ref sec_attached).
*
* @section elements Render elements
* Render elements are defined by Drupal core and modules. The primary way to
* define a render element is to create a render element plugin. There are
...
...
@@ -281,6 +284,24 @@
* properties. Look through implementations of hook_element_info() to discover
* elements defined this way.
*
* @section sec_attached Attaching libraries in render arrays
*
* The #attached property allows loading of CSS, JavaScript, libraries or custom
* types. Specify an array of type => value pairs, where the type (most often
* 'css', 'js', or 'library') determines the loading technique and the value
* provides the options specified to the loader function. Example:
* @code
* $form['#attached']['css'] = array(
* drupal_get_path('module', 'ajax_example') . '/ajax_example.css',
* );
*
* $form['#attached']['js'] = array(
* drupal_get_path('module', 'ajax_example') . '/ajax_example.js',
* );
* @endcode
*
* See drupal_process_attached() for additional information.
*
* @see themeable
*
* @}
...
...
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