[support] Remove inline class from node links

Dale McGladdery torelad at gmail.com
Sat Jul 12 06:21:34 UTC 2008


On Fri, Jul 11, 2008 at 6:56 PM, John Fletcher <net at twoedged.org> wrote:
[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