diff --git a/mongodb_block/block.tpl.php b/mongodb_block/block.tpl.php deleted file mode 100644 index 7703fae..0000000 --- a/mongodb_block/block.tpl.php +++ /dev/null @@ -1,56 +0,0 @@ -subject: Block title. - * - $content: Block content. - * - $block->module: Module that generated the block. - * - $block->delta: An ID for the block, unique within each module. - * - $block->region: The block region embedding the current block. - * - $classes: String of classes that can be used to style contextually through - * CSS. It can be manipulated through the variable $classes_array from - * preprocess functions. The default values can be one or more of the following: - * - block: The current template type, i.e., "theming hook". - * - block-[module]: The module generating the block. For example, the user module - * is responsible for handling the default user navigation block. In that case - * the class would be "block-user". - * - $title_prefix (array): An array containing additional output populated by - * modules, intended to be displayed in front of the main title tag that - * appears in the template. - * - $title_suffix (array): An array containing additional output populated by - * modules, intended to be displayed after the main title tag that appears in - * the template. - * - * Helper variables: - * - $classes_array: Array of html class attribute values. It is flattened - * into a string within the variable $classes. - * - $block_zebra: Outputs 'odd' and 'even' dependent on each block region. - * - $zebra: Same output as $block_zebra but independent of any block region. - * - $block_id: Counter dependent on each block region. - * - $id: Same output as $block_id but independent of any block region. - * - $is_front: Flags true when presented in the front page. - * - $logged_in: Flags true when the current user is a logged-in member. - * - $is_admin: Flags true when the current user is an administrator. - * - $block_html_id: A valid HTML ID and guaranteed unique. - * - * @see template_preprocess() - * @see template_preprocess_block() - * @see template_process() - */ -?> -
> - - - -subject): ?> - >subject ?> - - - -
> - -
-
diff --git a/mongodb_block/mongodb_block.module b/mongodb_block/mongodb_block.module index b0dba3b..e5d5c06 100644 --- a/mongodb_block/mongodb_block.module +++ b/mongodb_block/mongodb_block.module @@ -7,11 +7,11 @@ * Resembles very closely the core block module but without an UI. */ -if (!defined('BLOCK_REGION_NONE')) { +if (!defined('MONGODB_BLOCK_REGION_NONE')) { /** * Denotes that a block is not enabled in any region and should not be shown. */ - define('BLOCK_REGION_NONE', -1); + define('MONGODB_BLOCK_REGION_NONE', -1); } /** @@ -237,7 +237,7 @@ function _mongodb_block_rehash($theme) { 'pages' => array('%'), 'pages_exclude' => array(), 'status' => 0, - 'region' => BLOCK_REGION_NONE, + 'region' => MONGODB_BLOCK_REGION_NONE, ); if (isset($block['node_type'])) { $block['pages'] = array('node/%'); @@ -252,9 +252,9 @@ function _mongodb_block_rehash($theme) { drupal_alter('mongodb_block_info', $blocks, $theme); // Only store the block in the mongodb, if the status is enabled. foreach ($blocks as $key => $block) { - if ($block['region'] != BLOCK_REGION_NONE && !isset($regions[$block['region']])) { + if ($block['region'] != MONGODB_BLOCK_REGION_NONE && !isset($regions[$block['region']])) { $blocks[$key]['status'] = 0; - $blocks[$key]['region'] = BLOCK_REGION_NONE; + $blocks[$key]['region'] = MONGODB_BLOCK_REGION_NONE; $block = $blocks[$key]; } if ($block['status']) { @@ -288,7 +288,7 @@ function mongodb_block_save_block($collection, $block) { * * @see block.tpl.php */ -function template_preprocess_block(&$variables) { +function template_preprocess_mongodb_block(&$variables) { $block_counter = &drupal_static(__FUNCTION__, array()); $variables['block'] = $variables['elements']['#block']; // All blocks get an independent counter for each region. diff --git a/mongodb_block/mongodb_block.tpl.php b/mongodb_block/mongodb_block.tpl.php new file mode 100644 index 0000000..7703fae --- /dev/null +++ b/mongodb_block/mongodb_block.tpl.php @@ -0,0 +1,56 @@ +subject: Block title. + * - $content: Block content. + * - $block->module: Module that generated the block. + * - $block->delta: An ID for the block, unique within each module. + * - $block->region: The block region embedding the current block. + * - $classes: String of classes that can be used to style contextually through + * CSS. It can be manipulated through the variable $classes_array from + * preprocess functions. The default values can be one or more of the following: + * - block: The current template type, i.e., "theming hook". + * - block-[module]: The module generating the block. For example, the user module + * is responsible for handling the default user navigation block. In that case + * the class would be "block-user". + * - $title_prefix (array): An array containing additional output populated by + * modules, intended to be displayed in front of the main title tag that + * appears in the template. + * - $title_suffix (array): An array containing additional output populated by + * modules, intended to be displayed after the main title tag that appears in + * the template. + * + * Helper variables: + * - $classes_array: Array of html class attribute values. It is flattened + * into a string within the variable $classes. + * - $block_zebra: Outputs 'odd' and 'even' dependent on each block region. + * - $zebra: Same output as $block_zebra but independent of any block region. + * - $block_id: Counter dependent on each block region. + * - $id: Same output as $block_id but independent of any block region. + * - $is_front: Flags true when presented in the front page. + * - $logged_in: Flags true when the current user is a logged-in member. + * - $is_admin: Flags true when the current user is an administrator. + * - $block_html_id: A valid HTML ID and guaranteed unique. + * + * @see template_preprocess() + * @see template_preprocess_block() + * @see template_process() + */ +?> +
> + + + +subject): ?> + >subject ?> + + + +
> + +
+
diff --git a/mongodb_block_ui/mongodb_block_ui.admin.inc b/mongodb_block_ui/mongodb_block_ui.admin.inc index ab38bd0..7d1376b 100644 --- a/mongodb_block_ui/mongodb_block_ui.admin.inc +++ b/mongodb_block_ui/mongodb_block_ui.admin.inc @@ -53,7 +53,7 @@ function mongodb_block_ui_admin_display_form($form, &$form_state, $blocks, $them drupal_add_css(drupal_get_path('module', 'mongodb_block_ui') . '/mongodb_block_ui.css', array('preprocess' => FALSE)); - $blocks_regions = system_region_list($theme, REGIONS_VISIBLE) + array(BLOCK_REGION_NONE => '<' . t('none') . '>'); + $blocks_regions = system_region_list($theme, REGIONS_VISIBLE) + array(MONGODB_BLOCK_REGION_NONE => '<' . t('none') . '>'); // Weights range from -delta to +delta, so delta should be at least half // of the amount of mongodb_block_uis present. This makes sure all mongodb_block_uis in the same @@ -109,7 +109,7 @@ function mongodb_block_ui_admin_display_form($form, &$form_state, $blocks, $them } } // Do not allow disabling the main system content mongodb_block_ui. - unset($form['system_main']['region']['#options'][BLOCK_REGION_NONE]); + unset($form['system_main']['region']['#options'][MONGODB_BLOCK_REGION_NONE]); $form['actions'] = array( '#tree' => FALSE, @@ -171,7 +171,7 @@ function _mongodb_block_ui_compare($a, $b) { // We need the region list to correctly order by region. if (!isset($regions)) { $regions = array_flip(array_keys(system_region_list($theme))); - $regions[BLOCK_REGION_NONE] = count($regions); + $regions[MONGODB_BLOCK_REGION_NONE] = count($regions); } // Separate enabled from disabled. @@ -252,8 +252,8 @@ function mongodb_block_ui_admin_configure($form, &$form_state, $theme, $module, $form['regions'][$key] = array( '#type' => 'select', '#title' => $theme->info['name'], - '#default_value' => (!empty($region) ? $region : BLOCK_REGION_NONE), - '#options' => array(BLOCK_REGION_NONE => t('')) + system_region_list($key, REGIONS_VISIBLE), + '#default_value' => (!empty($region) ? $region : MONGODB_BLOCK_REGION_NONE), + '#options' => array(MONGODB_BLOCK_REGION_NONE => t('')) + system_region_list($key, REGIONS_VISIBLE), '#expandable' => ($key !== $theme_default), '#weight' => ($key == $theme_default ? 9 : 10), ); @@ -506,7 +506,7 @@ function mongodb_block_ui_custom_block_delete_submit($form, &$form_state) { function template_preprocess_mongodb_block_ui_admin_display_form(&$variables) { $block_regions = system_region_list($variables['form']['edited_theme']['#value'], REGIONS_VISIBLE); - $variables['block_regions'] = $block_regions + array(BLOCK_REGION_NONE => t('Disabled')); + $variables['block_regions'] = $block_regions + array(MONGODB_BLOCK_REGION_NONE => t('Disabled')); foreach ($block_regions as $key => $value) { // Initialize an empty array for the region. @@ -514,7 +514,7 @@ function template_preprocess_mongodb_block_ui_admin_display_form(&$variables) { } // Initialize disabled mongodb_block_uis array. - $variables['block_listing'][BLOCK_REGION_NONE] = array(); + $variables['block_listing'][MONGODB_BLOCK_REGION_NONE] = array(); // Set up to track previous region in loop. $last_region = ''; diff --git a/mongodb_block_ui/mongodb_block_ui.module b/mongodb_block_ui/mongodb_block_ui.module index 174def0..2c19dda 100644 --- a/mongodb_block_ui/mongodb_block_ui.module +++ b/mongodb_block_ui/mongodb_block_ui.module @@ -191,7 +191,7 @@ function mongodb_block_ui_mongodb_block_info_alter(&$blocks, $theme) { foreach (mongodb_collection('block_customized', $theme)->find() as $block) { $index = $block['_id']['module'] . '_' . $block['_id']['delta']; unset($block['_id']); - if (isset($block['region']) && $block['region'] != BLOCK_REGION_NONE) { + if (isset($block['region']) && $block['region'] != MONGODB_BLOCK_REGION_NONE) { $block['status'] = TRUE; } $blocks[$index] = $block + $blocks[$index];