Drupal development
zero dev header imagezero dev header imagezero dev header imagezero dev header image

Admin links dissapear on custom content

zero dev's picture

This is an ugly little hack to get around the fact that those lovely neat Admin module links disappear when you don't print $content in your tpl files. The other method would be to use something like contemplate, or panels to avoid the problem completly.

ok, here is the hack. 1. create a module admin_links:

<?php
/**
*Implementation of hook_link().
*/

function admin_links_link($type, $object, $teaser = FALSE) {
 
$links = array();

  if (
admin_is_enabled('admin inline')) {
   
$links = module_invoke_all('admin_link', $type, $object);
   
drupal_alter('admin_link', $links, $type, $object);
  }
  return
$links;
}
?>

2. Chuck this in the bottom of you're tpl file (just above the final closing div tag):

<?php if ($links): ?>
<div class='admin-inline'>
  <div class='admin-border admin-border-top'></div>
  <div class='admin-border admin-border-right'></div>
  <div class='admin-border admin-border-bottom'></div>
  <div class='admin-border admin-border-left'></div>
  <div class='admin-links clear-block'><?php print $links ?></div>
</div>
<?php endif;?>

Making sure that the node div has display: block; some where in the CSS.

Most of this is taken directly from the module itself - seems to work ok? It was just a quick fix for me.

Feel free to leave a comment if you have a better solution

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.

©2010 zero-dev

Powered by Drupal, an open source content management system