summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-05-15 21:30:02 +0000
committerDries Buytaert <dries@buytaert.net>2008-05-15 21:30:02 +0000
commit85c269ef409fbd082248ebacab40867a8586219e (patch)
tree17ff28bab53461198629eccf8d9c87eaa10064ab /modules
parent6b88e61700f87c98442534e4c9a2604b1cd8a057 (diff)
downloadbrdo-85c269ef409fbd082248ebacab40867a8586219e.tar.gz
brdo-85c269ef409fbd082248ebacab40867a8586219e.tar.bz2
- Patch #257634 by Senpai and catch: code clean-up
Diffstat (limited to 'modules')
-rw-r--r--modules/block/block-admin-display-form.tpl.php2
-rw-r--r--modules/block/block.admin.inc38
-rw-r--r--modules/block/block.info1
-rw-r--r--modules/block/block.install1
-rw-r--r--modules/block/block.js2
-rw-r--r--modules/block/block.module20
6 files changed, 36 insertions, 28 deletions
diff --git a/modules/block/block-admin-display-form.tpl.php b/modules/block/block-admin-display-form.tpl.php
index 5e45ca3f3..5195f4af1 100644
--- a/modules/block/block-admin-display-form.tpl.php
+++ b/modules/block/block-admin-display-form.tpl.php
@@ -2,7 +2,7 @@
// $Id$
/**
- * @file block-admin-display-form.tpl.php
+ * @file
* Default theme implementation to configure blocks.
*
* Available variables:
diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc
index 2c53c998c..eeff541ed 100644
--- a/modules/block/block.admin.inc
+++ b/modules/block/block.admin.inc
@@ -15,7 +15,7 @@ function block_admin_display($theme = NULL) {
// If non-default theme configuration has been selected, set the custom theme.
$custom_theme = isset($theme) ? $theme : variable_get('theme_default', 'garland');
- // Fetch and sort blocks
+ // Fetch and sort blocks.
$blocks = _block_rehash();
usort($blocks, '_block_compare');
@@ -28,7 +28,6 @@ function block_admin_display($theme = NULL) {
function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
global $theme_key, $custom_theme;
- // Add CSS
drupal_add_css(drupal_get_path('module', 'block') . '/block.css', 'module', 'all', FALSE);
// If non-default theme configuration has been selected, set the custom theme.
@@ -37,7 +36,7 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
$block_regions = system_region_list($theme_key) + array(BLOCK_REGION_NONE => '<' . t('none') . '>');
- // Build form tree
+ // Build the form tree.
$form = array(
'#action' => arg(3) ? url('admin/build/block/list/' . $theme_key) : url('admin/build/block'),
'#tree' => TRUE,
@@ -54,11 +53,11 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
'#value' => $block['delta'],
);
$form[$key]['info'] = array(
- '#value' => check_plain($block['info'])
+ '#value' => check_plain($block['info']),
);
$form[$key]['theme'] = array(
'#type' => 'hidden',
- '#value' => $theme_key
+ '#value' => $theme_key,
);
$form[$key]['weight'] = array(
'#type' => 'weight',
@@ -69,9 +68,15 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
'#default_value' => $block['region'],
'#options' => $block_regions,
);
- $form[$key]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/' . $block['module'] . '/' . $block['delta']));
+ $form[$key]['configure'] = array(
+ '#value' => l(t('configure'),
+ 'admin/build/block/configure/' . $block['module'] . '/' . $block['delta']),
+ );
if ($block['module'] == 'block') {
- $form[$key]['delete'] = array('#value' => l(t('delete'), 'admin/build/block/delete/' . $block['delta']));
+ $form[$key]['delete'] = array(
+ '#value' => l(t('delete'),
+ 'admin/build/block/delete/' . $block['delta']),
+ );
}
}
@@ -84,7 +89,7 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) {
}
/**
- * Process main blocks administration form submission.
+ * Process main blocks administration form submissions.
*/
function block_admin_display_form_submit($form, &$form_state) {
foreach ($form_state['values'] as $block) {
@@ -135,9 +140,14 @@ function _block_compare($a, $b) {
* Menu callback; displays the block configuration form.
*/
function block_admin_configure(&$form_state, $module = NULL, $delta = 0) {
-
- $form['module'] = array('#type' => 'value', '#value' => $module);
- $form['delta'] = array('#type' => 'value', '#value' => $delta);
+ $form['module'] = array(
+ '#type' => 'value',
+ '#value' => $module,
+ );
+ $form['delta'] = array(
+ '#type' => 'value',
+ '#value' => $delta,
+ );
$edit = db_fetch_array(db_query("SELECT pages, visibility, custom, title FROM {blocks} WHERE module = '%s' AND delta = '%s'", $module, $delta));
@@ -155,7 +165,6 @@ function block_admin_configure(&$form_state, $module = NULL, $delta = 0) {
'#weight' => -18,
);
-
// Module-specific block configurations.
if ($settings = module_invoke($module, 'block', 'configure', $delta)) {
foreach ($settings as $k => $v) {
@@ -187,7 +196,7 @@ function block_admin_configure(&$form_state, $module = NULL, $delta = 0) {
'#default_value' => $edit['custom'],
);
- // Role-based visibility settings
+ // Role-based visibility settings.
$default_role_options = array();
$result = db_query("SELECT rid FROM {blocks_roles} WHERE module = '%s' AND delta = '%s'", $module, $delta);
while ($role = db_fetch_object($result)) {
@@ -216,8 +225,8 @@ function block_admin_configure(&$form_state, $module = NULL, $delta = 0) {
'#title' => t('Page specific visibility settings'),
'#collapsible' => TRUE,
);
- $access = user_access('use PHP for block visibility');
+ $access = user_access('use PHP for block visibility');
if ($edit['visibility'] == 2 && !$access) {
$form['page_vis_settings'] = array();
$form['page_vis_settings']['visibility'] = array('#type' => 'value', '#value' => 2);
@@ -310,6 +319,7 @@ function block_add_block_form_submit($form, &$form_state) {
cache_clear_all();
$form_state['redirect'] = 'admin/build/block';
+
return;
}
diff --git a/modules/block/block.info b/modules/block/block.info
index 4b9dd2afc..a5db5bc82 100644
--- a/modules/block/block.info
+++ b/modules/block/block.info
@@ -1,4 +1,5 @@
; $Id$
+
name = Block
description = Controls the boxes that are displayed around the main content.
package = Core - required
diff --git a/modules/block/block.install b/modules/block/block.install
index 23cb8f30e..5abac2c60 100644
--- a/modules/block/block.install
+++ b/modules/block/block.install
@@ -167,4 +167,3 @@ function block_schema() {
return $schema;
}
-
diff --git a/modules/block/block.js b/modules/block/block.js
index abfe48d43..802f25666 100644
--- a/modules/block/block.js
+++ b/modules/block/block.js
@@ -82,7 +82,7 @@ Drupal.behaviors.blockDrag = function(context) {
rowObject.swap('after', this);
}
}
- // This region has become empty
+ // This region has become empty.
if ($(this).next('tr').is(':not(.draggable)') || $(this).next('tr').size() == 0) {
$(this).removeClass('region-populated').addClass('region-empty');
}
diff --git a/modules/block/block.module b/modules/block/block.module
index d3660c1ec..c2e29f078 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -6,10 +6,7 @@
* Controls the boxes that are displayed around the main content.
*/
-/**
- * Denotes that a block is not enabled in any region and should not
- * be shown.
- */
+// Denotes that a block is not enabled in any region and should not be shown.
define('BLOCK_REGION_NONE', -1);
/**
@@ -89,7 +86,7 @@ function block_help($path, $arg) {
}
/**
- * Implementation of hook_theme()
+ * Implementation of hook_theme().
*/
function block_theme() {
return array(
@@ -168,7 +165,7 @@ function block_menu() {
}
/**
- * Menu item access callback - only admin or enabled themes can be accessed
+ * Menu item access callback - only admin or enabled themes can be accessed.
*/
function _block_themes_access($theme) {
return user_access('administer blocks') && ($theme->status || $theme->name == variable_get('admin_theme', '0'));
@@ -396,7 +393,7 @@ function block_list($region) {
$blocks = _block_load_blocks();
}
- // Create an empty array if there were no entries
+ // Create an empty array if there were no entries.
if (!isset($blocks[$region])) {
$blocks[$region] = array();
}
@@ -407,7 +404,7 @@ function block_list($region) {
}
/**
- * Load blocks information from the database
+ * Load blocks information from the database.
*/
function _block_load_blocks() {
global $user, $theme_key;
@@ -419,7 +416,7 @@ function _block_load_blocks() {
if (!isset($blocks[$block->region])) {
$blocks[$block->region] = array();
}
- // Use the user's block visibility setting, if necessary
+ // Use the user's block visibility setting, if necessary.
if ($block->custom != 0) {
if ($user->uid && isset($user->block[$block->module][$block->delta])) {
$enabled = $user->block[$block->module][$block->delta];
@@ -432,7 +429,7 @@ function _block_load_blocks() {
$enabled = TRUE;
}
- // Match path if necessary
+ // Match path if necessary.
if ($block->pages) {
if ($block->visibility < 2) {
$path = drupal_get_path_alias($_GET['q']);
@@ -457,6 +454,7 @@ function _block_load_blocks() {
$block->page_match = $page_match;
$blocks[$block->region]["{$block->module}_{$block->delta}"] = $block;
}
+
return $blocks;
}
@@ -464,7 +462,7 @@ function _block_load_blocks() {
* Render the content and subject for a set of blocks.
*
* @param $region_blocks
- * An array of block objects such as returned for one region by _block_load_blocks()
+ * An array of block objects such as returned for one region by _block_load_blocks().
*
* @return
* An array of visible blocks with subject and content rendered.