summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries2012-02-08 14:49:23 (GMT)
committer Dries2012-02-08 14:49:23 (GMT)
commit51867cdc0704b56bc9b5dd2ec3de3407fb0fb96d (patch)
tree3760a3e45fb46f9940ecd68d579af5fe87424ac7
parent6e2a9031415733a2d3296a6f4618cfa4dba4bc1a (diff)
- Patch #1221718 by aspilicious, sun, skottler: refactor block-admin-display-form.tpl.php.
-rw-r--r--core/modules/block/block-admin-display-form.tpl.php9
-rw-r--r--core/modules/block/block.admin.inc16
2 files changed, 12 insertions, 13 deletions
diff --git a/core/modules/block/block-admin-display-form.tpl.php b/core/modules/block/block-admin-display-form.tpl.php
index 0ce2b6b..1728273 100644
--- a/core/modules/block/block-admin-display-form.tpl.php
+++ b/core/modules/block/block-admin-display-form.tpl.php
@@ -25,15 +25,6 @@
* @ingroup themeable
*/
?>
-<?php
- // Add table javascript.
- drupal_add_js('core/misc/tableheader.js');
- drupal_add_js(drupal_get_path('module', 'block') . '/block.js');
- foreach ($block_regions as $region => $title) {
- drupal_add_tabledrag('blocks', 'match', 'sibling', 'block-region-select', 'block-region-' . $region, NULL, FALSE);
- drupal_add_tabledrag('blocks', 'order', 'sibling', 'block-weight', 'block-weight-' . $region);
- }
-?>
<table id="blocks" class="sticky-enabled">
<thead>
<tr>
diff --git a/core/modules/block/block.admin.inc b/core/modules/block/block.admin.inc
index 2b3c2dd..e383e71 100644
--- a/core/modules/block/block.admin.inc
+++ b/core/modules/block/block.admin.inc
@@ -84,13 +84,22 @@ function block_admin_display_prepare_blocks($theme) {
* @see block_admin_display_form_submit()
*/
function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_regions = NULL) {
-
- $form['#attached']['css'] = array(drupal_get_path('module', 'block') . '/block.admin.css');
+ $path = drupal_get_path('module', 'block');
+ $form['#attached']['css'][] = $path . '/block.admin.css';
+ $form['#attached']['js'][] = 'core/misc/tableheader.js';
+ $form['#attached']['js'][] = $path . '/block.js';
// Get a list of block regions if one was not provided.
if (!isset($block_regions)) {
$block_regions = system_region_list($theme, REGIONS_VISIBLE);
}
+ // Add a last region for disabled blocks.
+ $block_regions_with_disabled = $block_regions + array(BLOCK_REGION_NONE => BLOCK_REGION_NONE);
+
+ foreach ($block_regions_with_disabled as $region => $title) {
+ $form['#attached']['drupal_add_tabledrag'][] = array('blocks', 'match', 'sibling', 'block-region-select', 'block-region-' . $region, NULL, FALSE);
+ $form['#attached']['drupal_add_tabledrag'][] = array('blocks', 'order', 'sibling', 'block-weight', 'block-weight-' . $region);
+ }
// 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
@@ -104,8 +113,7 @@ function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_r
);
$form['block_regions'] = array(
'#type' => 'value',
- // Add a last region for disabled blocks.
- '#value' => $block_regions + array(BLOCK_REGION_NONE => BLOCK_REGION_NONE),
+ '#value' => $block_regions_with_disabled,
);
$form['blocks'] = array();
$form['#tree'] = TRUE;