materio_page_title.module 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * Implements hook_block_info().
  4. */
  5. function materio_page_title_block_info() {
  6. // This example comes from node.module.
  7. /*
  8. *$blocks['syndicate'] = array(
  9. * 'info' => t('Syndicate'),
  10. * 'cache' => DRUPAL_NO_CACHE
  11. *);
  12. */
  13. $blocks['materio_page_title'] = array(
  14. 'info' => t('Materio page title'),
  15. 'cache' => DRUPAL_NO_CACHE
  16. );
  17. return $blocks;
  18. }
  19. /**
  20. * Implements hook_block_view().
  21. */
  22. function materio_page_title_block_view($delta = '') {
  23. $block = array();
  24. switch ($delta) {
  25. case 'materio_page_title':
  26. $block['subject'] = t('Page title');
  27. $block['content'] = theme('materio_page_title', array('title' => drupal_get_title()));
  28. drupal_add_js(drupal_get_path('module', 'materio_page_title').'/js/materio_page_title-ck.js');
  29. break;
  30. }
  31. return $block;
  32. }
  33. /**
  34. * Implements hook_theme().
  35. */
  36. function materio_page_title_theme($existing, $type, $theme, $path) {
  37. return array(
  38. 'materio_page_title' => array(
  39. 'variables' => array('title' => NULL,),
  40. ),
  41. );
  42. }
  43. function theme_materio_page_title($vars){
  44. if($vars['title'])
  45. return '<h1 id="materio-page-title" class="page-title">'.$vars['title'].'</h1>';
  46. return;
  47. }
  48. /**
  49. * Implements hook_menu().
  50. */
  51. // function materio_page_title_menu() {
  52. // $items = array();
  53. // $base = array(
  54. // 'type' => MENU_CALLBACK,
  55. // 'file' => 'materio_page_title.pages.inc',
  56. // );
  57. // $items['materio_page_title/refresh/block'] = $base+array(
  58. // 'title' => 'Materio page title refresh block',
  59. // 'page callback' => 'materio_page_title_refresh_block',
  60. // 'page arguments' => array(),
  61. // 'access callback' => TRUE,
  62. // );
  63. // return $items;
  64. // }