| 1 |
<?php
|
| 2 |
// $Id:
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Bringing Firebug to Drupal.
|
| 6 |
*/
|
| 7 |
|
| 8 |
/**
|
| 9 |
* Implementation of hook_perm().
|
| 10 |
*/
|
| 11 |
function firebug_perm() {
|
| 12 |
return array('administer firebug', 'access firebug');
|
| 13 |
}
|
| 14 |
|
| 15 |
/**
|
| 16 |
* Implementation of hook_menu().
|
| 17 |
*/
|
| 18 |
function firebug_menu($may_cache) {
|
| 19 |
$items = array();
|
| 20 |
|
| 21 |
if ($may_cache) {
|
| 22 |
$items[] = array(
|
| 23 |
'path' => 'admin/settings/firebug',
|
| 24 |
'title' => t('Firebug'),
|
| 25 |
'callback' => 'drupal_get_form',
|
| 26 |
'callback arguments' => array('firebug_settings'),
|
| 27 |
'access' => user_access('administer firebug'),
|
| 28 |
'type' => MENU_NORMAL_ITEM
|
| 29 |
);
|
| 30 |
}
|
| 31 |
|
| 32 |
if (user_access('access firebug')) {
|
| 33 |
$settings = array(
|
| 34 |
'path' => base_path() . drupal_get_path('module', 'firebug'),
|
| 35 |
'icon' => variable_get('firebug_icon', true)
|
| 36 |
);
|
| 37 |
drupal_add_js(array('firebug' => $settings), 'setting');
|
| 38 |
drupal_add_js(drupal_get_path('module', 'firebug') .'/firebug/firebug.js');
|
| 39 |
drupal_add_js(drupal_get_path('module', 'firebug') .'/firebug_controls.js');
|
| 40 |
}
|
| 41 |
|
| 42 |
return $items;
|
| 43 |
}
|
| 44 |
|
| 45 |
/**
|
| 46 |
* Settings page.
|
| 47 |
*/
|
| 48 |
function firebug_settings() {
|
| 49 |
$form['firebug_icon'] = array(
|
| 50 |
'#type' => 'checkbox',
|
| 51 |
'#title' => t('Display Firebug Icon'),
|
| 52 |
'#default_value' => variable_get('firebug_icon', true),
|
| 53 |
'#return_value' => true
|
| 54 |
);
|
| 55 |
|
| 56 |
return system_settings_form($form);
|
| 57 |
}
|