[support] Remove inline class from node links

John Fletcher net at twoedged.org
Mon Jul 28 08:03:41 UTC 2008


Thanks a lot Dale,

I'm using D6 but with a little modification this worked perfectly.  This is
exactly what I was looking for - the sort of "clean way" to do it.

Regards,
John 

-----Original Message-----
From: Dale McGladdery
Sent: Saturday, 12 July 2008 8:22 AM
To: support at drupal.org
Subject: Re: [support] Remove inline class from node links

 [snip]
> However that seems a little bit "hacky".  Is there not a "better way" -
> removing the class from the <ul>?  When I asked where the "inline" class
> comes from I meant: which piece of code adds the "inline" class so that it
> prints <ul class="links inline"> instead of <ul class="links">?  I know
> theme_links does this but it just prints the arguments that it is given...
> how does it get those arguments...?

If I'm following you correctly, and I'm not sure I am, you're wanting
to know where the value of the $links variable is assigned for node
templates. If I'm wrong, ignore the rest of this! :-)

In Drupal 5 the $links variable is assigned a value in
phptemplate.engine (/themes/engines/phptemplate/phptemplate.engine),
in the phptemplate_node function:
  $variables = array(
    [snip]
    'links'          => $node->links ? theme('links', $node->links,
array('class' => 'links inline')) : '',
    [snip]
  );

You can override this value for all template files in the
_phptemplate_variables function of your theme's template.php file with
something like (I haven't tested this):

  function _phptemplate_variables($hook, $vars = array()) {
    switch ($hook) {
      case 'node':
        $vars['links'] = $vars['node']->links ? theme('links',
$vars['node']->links, array('class' => 'links')) : ''
        break;
    }
    return $vars;
  }

Some additional info:
http://drupal.org/node/16383
http://www.group42.ca/take_control_your_phptemplate_variables




More information about the support mailing list