Guest User

Untitled

a guest
Oct 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. function MYMODULE_preprocess_user_profile(&$vars){
  2. // dsm($vars); // prints nice debugging information
  3. $vars['user_profile']['charity_link'] = array(
  4. '#markup' => l('Add Charity!', 'my/custom/link' . arg(1)),
  5. '#weight' => 10
  6. );
  7. }
  8.  
  9. <?php
  10. // unset the original template to set yours.
  11.  
  12. // Implement hook_theme_registry_alter
  13. function MODULENAME_theme_registry_alter(&$theme_registry) {
  14. $theme_registry['TEMPLATE_TO_OVERRIDE']['template'] = drupal_get_path('module', 'MODULENAME') . '/TEMPLATE_TO_OVERRIDE';
  15. $theme_registry['TEMPLATE_TO_OVERRIDE']['theme path'] = drupal_get_path('module', 'MODULENAME');
  16.  
  17. }
  18.  
  19. $theme_registry['user_profile'] = array(
  20. 'variables' => array(
  21. 'account' => NULL,
  22. ),
  23. 'template' => 'modules/user/user-profile',
  24. 'file' => 'modules/user/user.pages.inc',
  25. 'type' => 'module',
  26. 'theme path' => 'modules/user',
  27. 'preprocess functions' => array(
  28. 0 => 'template_preprocess',
  29. 1 => 'template_preprocess_user_profile',
  30. ),
  31. );
  32.  
  33. <?php
  34. // unset the original template to set yours.
  35.  
  36. // Implement hook_theme_registry_alter
  37. function MODULENAME_theme_registry_alter(&$theme_registry) {
  38. $theme_registry['TEMPLATE_TO_OVERRIDE']['theme_path'] =>
  39. drupal_get_path('module', 'MODULENAME'))
  40. }
  41. ?>
  42.  
  43. <?php
  44. // Implement hook_theme_registry_alter
  45. function MODULENAME_theme_registry_alter(&$theme_registry) {
  46. $theme_registry['TEMPLATE_TO_OVERRIDE']['theme path'] =
  47. drupal_get_path('module', 'MODULENAME');
  48. }
  49. ?>
  50.  
  51. /**
  52. * Implements hook_registry_alter().
  53. */
  54. function lml_node_theme_registry_alter(&$theme_registry) {
  55. $module_path = drupal_get_path('module', 'my_module');
  56. // Override the default template with our own.
  57. if (isset($theme_registry['toolbar'])) {
  58. $theme_registry['toolbar']['theme path'] = $module_path;
  59. $theme_registry['toolbar']['path'] = $module_path . '/templates';
  60. $theme_registry['toolbar']['template'] = 'mytemplate';
  61. }
  62. }
Add Comment
Please, Sign In to add comment