Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
fec2710a
Commit
fec2710a
authored
Jul 18, 2009
by
Dries
Browse files
- Patch
#511284
by catch, moshe weitzman: add html_top and move the admin toolbar into html_top.
parent
fb0c7c6d
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/block/block.admin.inc
View file @
fec2710a
...
...
@@ -34,7 +34,7 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
$custom_theme
=
isset
(
$theme
)
?
$theme
:
variable_get
(
'theme_default'
,
'garland'
);
drupal_theme_initialize
();
$block_regions
=
system_region_list
(
$theme_key
)
+
array
(
BLOCK_REGION_NONE
=>
'<'
.
t
(
'none'
)
.
'>'
);
$block_regions
=
system_region_list
(
$theme_key
,
REGIONS_VISIBLE
)
+
array
(
BLOCK_REGION_NONE
=>
'<'
.
t
(
'none'
)
.
'>'
);
// Weights range from -delta to +delta, so delta should be at least half
// of the amount of blocks present. This makes sure all blocks in the same
...
...
@@ -469,7 +469,7 @@ function block_box_delete_submit($form, &$form_state) {
function
template_preprocess_block_admin_display_form
(
&
$variables
)
{
global
$theme_key
;
$block_regions
=
system_region_list
(
$theme_key
);
$block_regions
=
system_region_list
(
$theme_key
,
REGIONS_VISIBLE
);
$variables
[
'block_regions'
]
=
$block_regions
+
array
(
BLOCK_REGION_NONE
=>
t
(
'Disabled'
));
foreach
(
$block_regions
as
$key
=>
$value
)
{
...
...
modules/block/block.module
View file @
fec2710a
...
...
@@ -236,10 +236,11 @@ function block_page_alter($page) {
drupal_theme_initialize
();
// Populate all block regions
$regions
=
system_region_list
(
$theme
);
$all_regions
=
system_region_list
(
$theme
);
$visible_regions
=
system_region_list
(
$theme
,
REGIONS_VISIBLE
);
// Load all region content assigned via blocks.
foreach
(
array_keys
(
$regions
)
as
$region
)
{
foreach
(
array_keys
(
$
all_
regions
)
as
$region
)
{
// Prevent left and right regions from rendering blocks when 'show_blocks' == FALSE.
if
(
!
empty
(
$page
[
'#show_blocks'
])
||
(
$region
!=
'left'
&&
$region
!=
'right'
))
{
// Assign blocks to region.
...
...
@@ -249,8 +250,8 @@ function block_page_alter($page) {
// Append region description if we are rendering the block admin page.
$item
=
menu_get_item
();
if
(
$item
[
'path'
]
==
'admin/build/block'
)
{
$description
=
'<div class="block-region">'
.
$regions
[
$region
]
.
'</div>'
;
if
(
$item
[
'path'
]
==
'admin/build/block'
&&
isset
(
$visible_regions
[
$region
])
)
{
$description
=
'<div class="block-region">'
.
$
all_
regions
[
$region
]
.
'</div>'
;
$page
[
$region
][
'block_description'
]
=
array
(
'#markup'
=>
$description
,
'#weight'
=>
15
,
...
...
modules/system/system.module
View file @
fec2710a
...
...
@@ -71,6 +71,17 @@
*/
define
(
'DRUPAL_REQUIRED'
,
2
);
/**
* Return only visible regions. @see system_region_list().
*/
define
(
'REGIONS_VISIBLE'
,
'visible'
);
/**
* Return all visible regions. @see system_region_list().
*/
define
(
'REGIONS_ALL'
,
'all'
);
/**
* Implement hook_help().
*/
...
...
@@ -1974,18 +1985,34 @@ function system_find_base_theme($themes, $key, $used_keys = array()) {
*
* @param $theme_key
* The name of a theme.
* @param $show
* Possible values: REGIONS_ALL or REGIONS_VISIBLE. Visible excludes hidden
* regions.
* @return
* An array of regions in the form $region['name'] = 'description'.
*/
function
system_region_list
(
$theme_key
)
{
function
system_region_list
(
$theme_key
,
$show
=
REGIONS_ALL
)
{
$list
=
&
drupal_static
(
__FUNCTION__
,
array
());
if
(
!
array_key_ex
ist
s
(
$theme_key
,
$list
))
{
if
(
empty
(
$l
ist
[
$theme_key
][
$show
]
))
{
$info
=
unserialize
(
db_query
(
"SELECT info FROM
{
system
}
WHERE type = :type AND name = :name"
,
array
(
':type'
=>
'theme'
,
':name'
=>
$theme_key
))
->
fetchField
());
$list
[
$theme_key
]
=
array_map
(
't'
,
$info
[
'regions'
]);
// If requested, suppress hidden regions. @see block_admin_display_form().
foreach
(
$info
[
'regions'
]
as
$name
=>
$label
)
{
if
(
$show
==
REGIONS_ALL
||
!
isset
(
$info
[
'regions_hidden'
])
||
!
in_array
(
$name
,
$info
[
'regions_hidden'
]))
{
$list
[
$theme_key
][
$show
][
$name
]
=
$label
;
}
}
}
return
$list
[
$theme_key
][
$show
];
}
return
$list
[
$theme_key
];
/**
* Implement hook_system_info_alter().
*/
function
system_system_info_alter
(
&
$info
,
$file
)
{
// Remove page-top from the blocks UI since it is reserved for modules to
// populate from outside the blocks system.
$info
[
'regions_hidden'
][]
=
'page_top'
;
}
/**
...
...
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