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
219
Merge Requests
219
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
babb2b71
Commit
babb2b71
authored
Jun 09, 2013
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1825090
by thedavidmeister, Cottser: Remove theme_html_tag() from the theme system.
parent
a4484238
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
82 deletions
+88
-82
core/includes/common.inc
core/includes/common.inc
+39
-1
core/includes/theme.inc
core/includes/theme.inc
+0
-42
core/modules/config/config.admin.inc
core/modules/config/config.admin.inc
+1
-1
core/modules/system/lib/Drupal/system/Tests/Common/HtmlTagTest.php
...les/system/lib/Drupal/system/Tests/Common/HtmlTagTest.php
+47
-0
core/modules/system/lib/Drupal/system/Tests/Theme/HtmlTagUnitTest.php
.../system/lib/Drupal/system/Tests/Theme/HtmlTagUnitTest.php
+0
-36
core/modules/system/system.module
core/modules/system/system.module
+1
-2
No files found.
core/includes/common.inc
View file @
babb2b71
...
...
@@ -329,7 +329,7 @@ function drupal_get_breadcrumb() {
* @return
* An array of all stored HEAD elements.
*
* @see
theme
_html_tag()
* @see
drupal_pre_render
_html_tag()
*/
function
drupal_add_html_head
(
$data
=
NULL
,
$key
=
NULL
)
{
$stored_head
=
&
drupal_static
(
__FUNCTION__
);
...
...
@@ -4463,6 +4463,44 @@ function drupal_pre_render_conditional_comments($elements) {
return
$elements
;
}
/**
* Pre-render callback: Renders a generic HTML tag with attributes into #markup.
*
* @param array $element
* An associative array containing:
* - #tag: The tag name to output. Typical tags added to the HTML HEAD:
* - meta: To provide meta information, such as a page refresh.
* - link: To refer to stylesheets and other contextual information.
* - script: To load JavaScript.
* - #attributes: (optional) An array of HTML attributes to apply to the
* tag.
* - #value: (optional) A string containing tag content, such as inline
* CSS.
* - #value_prefix: (optional) A string to prepend to #value, e.g. a CDATA
* wrapper prefix.
* - #value_suffix: (optional) A string to append to #value, e.g. a CDATA
* wrapper suffix.
*/
function
drupal_pre_render_html_tag
(
$element
)
{
$attributes
=
isset
(
$element
[
'#attributes'
])
?
new
Attribute
(
$element
[
'#attributes'
])
:
''
;
if
(
!
isset
(
$element
[
'#value'
]))
{
$markup
=
'<'
.
$element
[
'#tag'
]
.
$attributes
.
" />
\n
"
;
}
else
{
$markup
=
'<'
.
$element
[
'#tag'
]
.
$attributes
.
'>'
;
if
(
isset
(
$element
[
'#value_prefix'
]))
{
$markup
.
=
$element
[
'#value_prefix'
];
}
$markup
.
=
$element
[
'#value'
];
if
(
isset
(
$element
[
'#value_suffix'
]))
{
$markup
.
=
$element
[
'#value_suffix'
];
}
$markup
.
=
'</'
.
$element
[
'#tag'
]
.
">
\n
"
;
}
$element
[
'#markup'
]
=
$markup
;
return
$element
;
}
/**
* Pre-render callback: Renders a link into #markup.
*
...
...
core/includes/theme.inc
View file @
babb2b71
...
...
@@ -2418,45 +2418,6 @@ function theme_feed_icon($variables) {
}
}
/**
* Returns HTML for a generic HTML tag with attributes.
*
* @param $variables
* An associative array containing:
* - element: An associative array describing the tag:
* - #tag: The tag name to output. Typical tags added to the HTML HEAD:
* - meta: To provide meta information, such as a page refresh.
* - link: To refer to stylesheets and other contextual information.
* - script: To load JavaScript.
* - #attributes: (optional) An array of HTML attributes to apply to the
* tag.
* - #value: (optional) A string containing tag content, such as inline
* CSS.
* - #value_prefix: (optional) A string to prepend to #value, e.g. a CDATA
* wrapper prefix.
* - #value_suffix: (optional) A string to append to #value, e.g. a CDATA
* wrapper suffix.
*/
function
theme_html_tag
(
$variables
)
{
$element
=
$variables
[
'element'
];
$attributes
=
isset
(
$element
[
'#attributes'
])
?
new
Attribute
(
$element
[
'#attributes'
])
:
''
;
if
(
!
isset
(
$element
[
'#value'
]))
{
return
'<'
.
$element
[
'#tag'
]
.
$attributes
.
" />
\n
"
;
}
else
{
$output
=
'<'
.
$element
[
'#tag'
]
.
$attributes
.
'>'
;
if
(
isset
(
$element
[
'#value_prefix'
]))
{
$output
.
=
$element
[
'#value_prefix'
];
}
$output
.
=
$element
[
'#value'
];
if
(
isset
(
$element
[
'#value_suffix'
]))
{
$output
.
=
$element
[
'#value_suffix'
];
}
$output
.
=
'</'
.
$element
[
'#tag'
]
.
">
\n
"
;
return
$output
;
}
}
/**
* Returns HTML for a "more" link, like those used in blocks.
*
...
...
@@ -3230,9 +3191,6 @@ function drupal_common_theme() {
'indentation'
=>
array
(
'variables'
=>
array
(
'size'
=>
1
),
),
'html_tag'
=>
array
(
'render element'
=>
'element'
,
),
// From theme.maintenance.inc.
'maintenance_page'
=>
array
(
'variables'
=>
array
(
'content'
=>
NULL
,
'show_messages'
=>
TRUE
),
...
...
core/modules/config/config.admin.inc
View file @
babb2b71
...
...
@@ -51,7 +51,7 @@ function config_admin_sync_form(array &$form, array &$form_state, StorageInterfa
// @todo A table caption would be more appropriate, but does not have the
// visual importance of a heading.
$form
[
$config_change_type
][
'heading'
]
=
array
(
'#t
heme'
=>
'html_tag__h3
'
,
'#t
ype'
=>
'html_tag
'
,
'#tag'
=>
'h3'
,
);
switch
(
$config_change_type
)
{
...
...
core/modules/system/lib/Drupal/system/Tests/Common/HtmlTagTest.php
0 → 100644
View file @
babb2b71
<?php
/**
* @file
* Contains \Drupal\system\Tests\Common\HtmlTagTest.
*/
namespace
Drupal\system\Tests\Common
;
use
Drupal\simpletest\WebTestBase
;
/**
* Tests for #type 'html_tag'.
*/
class
HtmlTagTest
extends
WebTestBase
{
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'Render HTML tags'
,
'description'
=>
'Tests rendering of html_tag type renderable arrays.'
,
'group'
=>
'Common'
,
);
}
/**
* Tests #type 'html_tag'.
*/
function
testHtmlTag
()
{
// Test auto-closure meta tag generation.
$tag
=
array
(
'#type'
=>
'html_tag'
,
'#tag'
=>
'meta'
,
'#attributes'
=>
array
(
'name'
=>
'description'
,
'content'
=>
'Drupal test'
,
),
);
$this
->
assertEqual
(
'<meta name="description" content="Drupal test" />'
.
"
\n
"
,
drupal_render
(
$tag
),
'Test auto-closure meta tag generation.'
);
// Test title tag generation.
$tag
=
array
(
'#type'
=>
'html_tag'
,
'#tag'
=>
'title'
,
'#value'
=>
'title test'
,
);
$this
->
assertEqual
(
'<title>title test</title>'
.
"
\n
"
,
drupal_render
(
$tag
),
'Test title tag generation.'
);
}
}
core/modules/system/lib/Drupal/system/Tests/Theme/HtmlTagUnitTest.php
deleted
100644 → 0
View file @
a4484238
<?php
/**
* @file
* Definition of Drupal\system\Tests\Theme\HtmlTagUnitTest.
*/
namespace
Drupal\system\Tests\Theme
;
use
Drupal\simpletest\UnitTestBase
;
/**
* Unit tests for theme_html_tag().
*/
class
HtmlTagUnitTest
extends
UnitTestBase
{
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'Theme HTML Tag'
,
'description'
=>
'Tests theme_html_tag() built-in theme functions.'
,
'group'
=>
'Theme'
,
);
}
/**
* Test function theme_html_tag()
*/
function
testThemeHtmlTag
()
{
// Test auto-closure meta tag generation
$tag
[
'element'
]
=
array
(
'#tag'
=>
'meta'
,
'#attributes'
=>
array
(
'name'
=>
'description'
,
'content'
=>
'Drupal test'
));
$this
->
assertEqual
(
'<meta name="description" content="Drupal test" />'
.
"
\n
"
,
theme_html_tag
(
$tag
),
'Test auto-closure meta tag generation.'
);
// Test title tag generation
$tag
[
'element'
]
=
array
(
'#tag'
=>
'title'
,
'#value'
=>
'title test'
);
$this
->
assertEqual
(
'<title>title test</title>'
.
"
\n
"
,
theme_html_tag
(
$tag
),
'Test title tag generation.'
);
}
}
core/modules/system/system.module
View file @
babb2b71
...
...
@@ -276,8 +276,7 @@ function system_element_info() {
'#error'
=>
NULL
,
);
$types
[
'html_tag'
]
=
array
(
'#theme'
=>
'html_tag'
,
'#pre_render'
=>
array
(
'drupal_pre_render_conditional_comments'
),
'#pre_render'
=>
array
(
'drupal_pre_render_conditional_comments'
,
'drupal_pre_render_html_tag'
),
'#attributes'
=>
array
(),
'#value'
=>
NULL
,
);
...
...
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