| 1 |
<?php |
<?php |
| 2 |
|
/** |
| 3 |
|
* Implementation of hook_perm(). |
| 4 |
|
*/ |
| 5 |
|
function export_docbook_tidyfilter_perm() { |
| 6 |
|
return array('use Tidy link') ; |
| 7 |
|
} |
| 8 |
|
|
| 9 |
function export_docbook_tidyfilter_menu($may_cache) { |
function export_docbook_tidyfilter_menu($may_cache) { |
| 10 |
$items = array(); |
$items = array(); |
|
|
|
| 11 |
if ($may_cache) { |
if ($may_cache) { |
| 12 |
$items[] = array('path' => 'tidyfilter', |
$items[] = array('path' => 'tidyfilter', |
| 13 |
'title' => t('Tidy up HTML'), |
'title' => t('Tidy up HTML'), |
| 19 |
return $items; |
return $items; |
| 20 |
} |
} |
| 21 |
|
|
| 22 |
|
/** |
| 23 |
|
* Implementation of hook_form_alter(). |
| 24 |
|
*/ |
| 25 |
function export_docbook_tidyfilter_form_alter($form_id, &$form) { |
function export_docbook_tidyfilter_form_alter($form_id, &$form) { |
| 26 |
|
if (user_access('use Tidy link') && isset($form['type']['#value']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) { |
|
if (strpos($form_id, 'node_form')) { |
|
| 27 |
$tidy_url = url('tidyfilter', NULL, NULL, TRUE); |
$tidy_url = url('tidyfilter', NULL, NULL, TRUE); |
| 28 |
drupal_add_js("var tidyUrl = '$tidy_url';", 'inline'); |
drupal_add_js("var tidyUrl = '$tidy_url';", 'inline'); |
| 29 |
drupal_add_js(drupal_get_path('module', 'export_docbook_tidyfilter') . '/export_docbook_tidyfilter.js'); |
drupal_add_js(drupal_get_path('module', 'export_docbook_tidyfilter') . '/export_docbook_tidyfilter.js'); |