Commit 0597c9e4 authored by Dries's avatar Dries

- Patch #560746 by dropcube: rename hook_block_list() to hook_block_info() for...

- Patch #560746 by dropcube: rename hook_block_list() to hook_block_info() for consistency in the API.
parent fb0275fa
......@@ -319,9 +319,9 @@ function aggregator_cron() {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function aggregator_block_list() {
function aggregator_block_info() {
$block = array();
$result = db_query('SELECT cid, title FROM {aggregator_category} ORDER BY title');
foreach ($result as $category) {
......
......@@ -249,7 +249,7 @@ function block_admin_configure(&$form_state, $module = NULL, $delta = 0) {
}
// Get the block subject for the page title.
$info = module_invoke($module, 'block_list');
$info = module_invoke($module, 'block_info');
if (isset($info[$delta])) {
drupal_set_title(t("'%name' block", array('%name' => $info[$delta]['info'])), PASS_THROUGH);
}
......
......@@ -12,7 +12,7 @@
*/
/**
* List of all blocks defined by the module.
* Define all blocks provided by the module.
*
* Any module can export a block (or blocks) to be displayed by defining
* the _block hook. This hook is called by theme.inc to display a block,
......@@ -52,7 +52,7 @@
*
* For a detailed usage example, see block_example.module.
*/
function hook_block_list() {
function hook_block_info() {
$blocks['exciting'] = array(
'info' => t('An exciting block provided by Mymodule.'),
'weight' => 0,
......@@ -76,7 +76,7 @@ function hook_block_list() {
* Which block to return. This is a descriptive string used to identify
* blocks within each module and also within the theme system.
* The $delta for each block is defined within the array that your module
* returns when the hook_block_list() implementation is called.
* returns when the hook_block_info() implementation is called.
* @return
* Optionally return the configuration form.
*
......@@ -101,7 +101,7 @@ function hook_block_configure($delta = '') {
* Which block to save the settings for. This is a descriptive string used
* to identify blocks within each module and also within the theme system.
* The $delta for each block is defined within the array that your module
* returns when the hook_block_list() implementation is called.
* returns when the hook_block_info() implementation is called.
* @param $edit
* The submitted form data from the configuration form.
*
......@@ -120,7 +120,7 @@ function hook_block_save($delta = '', $edit = array()) {
* Which block to return. This is a descriptive string used to identify
* blocks within each module and also within the theme system.
* The $delta for each block is defined within the array that your module
* returns when the hook_block_list() implementation is called.
* returns when the hook_block_info() implementation is called.
* @return
* An array which must define a 'subject' element and a 'content' element
* defining the block indexed by $delta.
......@@ -166,7 +166,7 @@ function hook_block_view($delta = '') {
* This example shows how to achieve language specific visibility setting for
* blocks.
*/
function hook_block_list_alter(&$blocks) {
function hook_block_info_alter(&$blocks) {
global $language, $theme_key;
$result = db_query('SELECT module, delta, language FROM {my_table}');
......
......@@ -15,7 +15,7 @@
* Constants defining cache granularity for blocks.
*
* Modules specify the caching patterns for their blocks using binary
* combinations of these constants in their hook_block_list():
* combinations of these constants in their hook_block_info():
* $block[delta]['cache'] = BLOCK_CACHE_PER_ROLE | BLOCK_CACHE_PER_PAGE;
* BLOCK_CACHE_PER_ROLE is used as a default when no caching pattern is
* specified.
......@@ -187,9 +187,9 @@ function _block_themes_access($theme) {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function block_block_list() {
function block_block_info() {
$blocks = array();
$result = db_query('SELECT bid, info FROM {block_custom} ORDER BY info');
......@@ -312,8 +312,8 @@ function _block_rehash() {
// Valid region names for the theme.
$regions = system_region_list($theme_key);
foreach (module_implements('block_list') as $module) {
$module_blocks = module_invoke($module, 'block_list');
foreach (module_implements('block_info') as $module) {
$module_blocks = module_invoke($module, 'block_info');
if ($module_blocks) {
foreach ($module_blocks as $delta => $block) {
if (empty($old_blocks[$module][$delta])) {
......@@ -437,7 +437,7 @@ function block_user_form(&$edit, $account, $category) {
'#tree' => TRUE
);
foreach ($result as $block) {
$data = module_invoke($block->module, 'block_list');
$data = module_invoke($block->module, 'block_info');
if ($data[$block->delta]['info']) {
$return = TRUE;
$form['block'][$block->module][$block->delta] = array(
......@@ -576,24 +576,24 @@ function _block_load_blocks() {
->addTag('block_load')
->execute();
$block_list = $result->fetchAllAssoc('bid');
$block_info = $result->fetchAllAssoc('bid');
// Allow modules to modify the block list.
drupal_alter('block_list', $block_list);
drupal_alter('block_info', $block_info);
$blocks = array();
foreach ($block_list as $block) {
foreach ($block_info as $block) {
$blocks[$block->region]["{$block->module}_{$block->delta}"] = $block;
}
return $blocks;
}
/**
* Implement hook_block_list_alter().
* Implement hook_block_info_alter().
*
* Check the page, user role, content type and user specific visibilty settings.
* Remove the block if the visibility conditions are not met.
*/
function block_block_list_alter(&$blocks) {
function block_block_info_alter(&$blocks) {
global $user, $theme_key;
// Build an array of roles for each block.
......
......@@ -150,9 +150,9 @@ function _blog_post_exists($account) {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function blog_block_list() {
function blog_block_info() {
$block['recent']['info'] = t('Recent blog posts');
return $block;
}
......
......@@ -207,9 +207,9 @@ function book_field_build_modes($obj_type) {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function book_block_list() {
function book_block_info() {
$block = array();
$block['navigation']['info'] = t('Book navigation');
$block['navigation']['cache'] = BLOCK_CACHE_PER_PAGE | BLOCK_CACHE_PER_ROLE;
......
......@@ -278,9 +278,9 @@ function comment_permission() {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function comment_block_list() {
function comment_block_info() {
$blocks['recent']['info'] = t('Recent comments');
return $blocks;
......
......@@ -476,9 +476,9 @@ function forum_form_alter(&$form, $form_state, $form_id) {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function forum_block_list() {
function forum_block_info() {
$blocks['active']['info'] = t('Active forum topics');
$blocks['new']['info'] = t('New forum topics');
return $blocks;
......
......@@ -629,9 +629,9 @@ function locale_css_alter(&$css) {
// Language switcher block
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function locale_block_list() {
function locale_block_info() {
$block['language-switcher']['info'] = t('Language switcher');
// Not worth caching.
$block['language-switcher']['cache'] = BLOCK_NO_CACHE;
......
......@@ -274,9 +274,9 @@ function menu_reset_item($item) {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function menu_block_list() {
function menu_block_info() {
$menus = menu_get_menus(FALSE);
$blocks = array();
......
......@@ -1761,9 +1761,9 @@ function node_revision_list($node) {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function node_block_list() {
function node_block_info() {
$blocks['syndicate']['info'] = t('Syndicate');
// Not worth caching.
$blocks['syndicate']['cache'] = BLOCK_NO_CACHE;
......
......@@ -117,9 +117,9 @@ function _poll_menu_access($node, $perm, $inspect_allowvotes) {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function poll_block_list() {
function poll_block_info() {
if (user_access('access content')) {
$blocks['recent']['info'] = t('Most recent poll');
return $blocks;
......
......@@ -133,9 +133,9 @@ function profile_menu() {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function profile_block_list() {
function profile_block_info() {
$blocks['author-information']['info'] = t('Author information');
$blocks['author-information']['cache'] = BLOCK_CACHE_PER_PAGE | BLOCK_CACHE_PER_ROLE;
return $blocks;
......
......@@ -161,9 +161,9 @@ function search_permission() {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function search_block_list() {
function search_block_info() {
$blocks['form']['info'] = t('Search form');
// Not worth caching.
$blocks['form']['cache'] = BLOCK_NO_CACHE;
......
......@@ -294,9 +294,9 @@ function statistics_get($nid) {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function statistics_block_list() {
function statistics_block_info() {
if (variable_get('statistics_count_content_views', 0)) {
$blocks['popular']['info'] = t('Popular content');
// Too dynamic to cache.
......
......@@ -1560,9 +1560,9 @@ function system_user_timezone(&$edit, &$form) {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function system_block_list() {
function system_block_info() {
$blocks['main'] = array(
'info' => t('Main page content'),
// Cached elsewhere.
......
......@@ -984,9 +984,9 @@ function user_login_block() {
}
/**
* Implement hook_block_list().
* Implement hook_block_info().
*/
function user_block_list() {
function user_block_info() {
global $user;
$blocks['login']['info'] = t('User login');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment