| 1 |
<?php |
<?php |
| 2 |
|
// $Id: |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Enables the use of a block bar container. |
* Enables the use of a block bar container. |
| 6 |
*/ |
*/ |
|
/** |
|
|
* Implementation of hook_help(). |
|
|
*/ |
|
|
function blockbar_help($section) { |
|
|
switch ($section) { |
|
|
case 'admin/modules#description': |
|
|
return t('Enables the use of a blockbar block container.'); |
|
|
} |
|
|
} |
|
| 7 |
|
|
| 8 |
/** |
/** |
| 9 |
* Menu callback: block bar. |
* Menu callback: block bar. |
| 11 |
function blockbar_build_blockbar($block_num = NULL) { |
function blockbar_build_blockbar($block_num = NULL) { |
| 12 |
static $sent = array(); |
static $sent = array(); |
| 13 |
if (!isset($sent[drupal_get_path('module','blockbar') . '/blockbar.css'])) { |
if (!isset($sent[drupal_get_path('module','blockbar') . '/blockbar.css'])) { |
| 14 |
theme_add_style(drupal_get_path('module','blockbar') .'/blockbar.css'); |
drupal_add_css(drupal_get_path('module', 'blockbar') .'/blockbar.css'); |
| 15 |
$sent[drupal_get_path('module','blockbar') . '/blockbar.css'] = TRUE; |
$sent[drupal_get_path('module','blockbar') . '/blockbar.css'] = TRUE; |
| 16 |
} |
} |
| 17 |
if (!isset($sent[drupal_get_path('module','blockbar') . '/blockbar.js'])) { |
if (!isset($sent[drupal_get_path('module','blockbar') . '/blockbar.js'])) { |
| 49 |
return $content; |
return $content; |
| 50 |
} |
} |
| 51 |
|
|
| 52 |
|
function blockbar_menu($maycache) { |
| 53 |
|
$items = array(); |
| 54 |
|
$items[] = array( |
| 55 |
|
'path' => 'admin/settings/blockbar', |
| 56 |
|
'title' => t('BlockBar'), |
| 57 |
|
'description' => t('BlockBar settings'), |
| 58 |
|
'callback' => 'drupal_get_form', |
| 59 |
|
'callback arguments' => 'blockbar_admin_settings', |
| 60 |
|
'access' => user_access('administer site configuration'), |
| 61 |
|
'type' => MENU_NORMAL_ITEM |
| 62 |
|
); |
| 63 |
|
return $items; |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
function blockbar_admin_settings() { |
| 67 |
|
$number_of_blocks = drupal_map_assoc(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); |
| 68 |
|
|
| 69 |
|
$form = array(); |
| 70 |
|
$form['block'] = array( |
| 71 |
|
'#type' => 'fieldset', '#title' => t('Block settings'), |
| 72 |
|
'#collapsible' => FALSE, '#collapsed' => False |
| 73 |
|
); |
| 74 |
|
$form['block']['blockbar_number_of_blocks'] = array( |
| 75 |
|
'#type' => 'select', '#title' => t('Number of blocks'), '#default_value' => variable_get('blockbar_number_of_blocks', 0), '#options' => $number_of_blocks, |
| 76 |
|
'#description' => t('Select the number of BlockBar blocks you wish to generate. BlockBar blocks are configured individually in the block configuration pages.') |
| 77 |
|
); |
| 78 |
|
|
| 79 |
|
return system_settings_form($form); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
function theme_blockbar_build_panels($panel_title, $panel_id, $blockbar_num, $block){ |
function theme_blockbar_build_panels($panel_title, $panel_id, $blockbar_num, $block){ |
| 83 |
// when overriding this theme function care should be taken so as to not break the javascript |
// when overriding this theme function care should be taken so as to not break the javascript |
| 84 |
// being called in the onclick event of the title <div> |
// being called in the onclick event of the title <div> |
| 95 |
return $output; |
return $output; |
| 96 |
} |
} |
| 97 |
|
|
|
/** |
|
|
* Implementation of hook_settings(). |
|
|
*/ |
|
|
function blockbar_settings() { |
|
|
$number_of_blocks = drupal_map_assoc(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)); |
|
|
|
|
|
$form['block'] = array( |
|
|
'#type' => 'fieldset', '#title' => t('Block settings'), |
|
|
'#collapsible' => FALSE, '#collapsed' => False |
|
|
); |
|
|
$form['block']['blockbar_number_of_blocks'] = array( |
|
|
'#type' => 'select', '#title' => t('Number of blocks'), '#default_value' => variable_get('blockbar_number_of_blocks', 0), '#options' => $number_of_blocks, |
|
|
'#description' => t('Select the number of BlockBar blocks you wish to generate. BlockBar blocks are configured individually in the block configuration pages.') |
|
|
); |
|
|
|
|
|
return $form; |
|
|
} |
|
|
|
|
| 98 |
function _blockbar_settings_form($block_num = NULL){ |
function _blockbar_settings_form($block_num = NULL){ |
| 99 |
$form['blockbar_name' . $block_num] = array( |
$form['blockbar_name' . $block_num] = array( |
| 100 |
'#type' => 'textfield', |
'#type' => 'textfield', |