[development] Altering links

Carl Wiedemann carl.wiedemann at gmail.com
Thu Nov 18 22:18:16 UTC 2010


Preprocess functions will allow you to change the text of the link as well.
Call devel module's dpm() function to inspect the links array in the
preprocess function http://drupalcontrib.org/api/function/dpm. Change the
'title' attribute of the link depending on $node->comment_count.

dpm() output: http://imagebin.ca/view/WdTNRdD.html


On Thu, Nov 18, 2010 at 2:10 PM, Salvatore De Paolis <iwkse at gmx.com> wrote:

> On Thu, 18 Nov 2010 13:21:48 -0700
> Carl Wiedemann <carl.wiedemann at gmail.com> wrote:
>
> >   // Add to particular link class.
> >   if (empty($node->links['comment_comments']['attributes']['class'])) {
> >     $node->links['comment_comments']['attributes']['class'] = $myclass;
> >   }
> >   else {
> >     $node->links['comment_comments']['attributes']['class'] .= ' ' .
> > $myclass;
> >   }
> >
> >   // Reformat all links
> >   $vars['links'] = !empty($node->links) ? theme('links', $node->links,
> > array('class' => 'links inline')) : '';
> > }
> > // END
>
> Maybe I am misunderstanding it or/and I did not explain good.
> Is not it supposed to show the text "no comments" when there are not
> comments and instead when some comments it shows the text together with
> the icon?
> I want something different, when no comments, it shows no text but only
> the icon. When some comments, it shows both text and icons.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20101118/423c28fb/attachment.html 


More information about the development mailing list