| 1 |
<?php
|
| 2 |
// $Id: chili_highlighter.module,v 1.2 2009/02/15 03:37:26 kourge Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_menu().
|
| 6 |
*/
|
| 7 |
function chili_highlighter_menu($maycache) {
|
| 8 |
if (!$maycache) {
|
| 9 |
$path = drupal_get_path('module', 'chili_highlighter') .'/chili';
|
| 10 |
drupal_add_js($path .'/jquery.chili-2.2.js');
|
| 11 |
$settings = array(
|
| 12 |
'ChiliBook.recipeFolder', 'ChiliBook.stylesheetFolder',
|
| 13 |
"'". url($path) ."/';"
|
| 14 |
);
|
| 15 |
drupal_add_js(implode(' = ', $settings), 'inline');
|
| 16 |
$selector = variable_get('chili_highlighter_selector', 'code');
|
| 17 |
$code = array(
|
| 18 |
'jQuery(function(){jQuery(', drupal_to_js($selector), ').chili();});'
|
| 19 |
);
|
| 20 |
drupal_add_js(implode('', $code), 'inline');
|
| 21 |
} else {
|
| 22 |
return array(array(
|
| 23 |
'path' => 'admin/settings/chili_highlighter',
|
| 24 |
'title' => t('Chili Highlighter'),
|
| 25 |
'callback' => 'drupal_get_form',
|
| 26 |
'callback arguments' => 'chili_highlighter_settings',
|
| 27 |
'access' => user_access('administer site configuration'),
|
| 28 |
'description' => t('Configure which parts of the page should be highlighted as code.')
|
| 29 |
));
|
| 30 |
}
|
| 31 |
}
|
| 32 |
|
| 33 |
function chili_highlighter_settings() {
|
| 34 |
return system_settings_form(array(
|
| 35 |
'chili_highlighter_selector' => array(
|
| 36 |
'#type' => 'textfield',
|
| 37 |
'#title' => t('Code Section CSS Selector'),
|
| 38 |
'#default_value' => variable_get('chili_highlighter_selector', 'code'),
|
| 39 |
'#description' => t('This is a CSS selector that specifies which elements are considered "code" and should be highlighted.')
|
| 40 |
)
|
| 41 |
));
|
| 42 |
}
|