how to make block title linked to archive?

math_1048 - June 9, 2009 - 18:25
Project:Taxonews
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hello my friends
how to make block title linked to archive?
thanks and best regards

#1

fgm - June 10, 2009 - 07:19
Status:active» needs review

Hi,

I'm not sure I understand your question. If you want to have the title of a taxonews block be a A HREF like the "archive" link at the bottom of the block, there is just no direct way: Block titles in Drupal are typically not links, so this would break consistency and you can't do it in the block admin UI, and taxonews itself has no mechanism for this.

Since this would not be consistent with the rest of Drupal, I suggest you don't do this, and theme the "archive" link instead, to give it more visibility.

Does this answer your question ?

#2

math_1048 - June 10, 2009 - 13:45

yes that exactly what Iam looking for;
thank you for your help,I just try using
_preprocess_block(&$vars)
function in my theme
by adding the lines

if (isset($vars['block']->module) && ($vars['block']->module == 'taxonews')) {
   
        $vars['block']->subject = l($vars['block']->subject, $taxonews_block_title->tid,array('absolute' => TRUE));
  }

while the variable $taxonews_block_title - carry the $tid form the theming function of the taxonews as a global variable
theme_taxonews_block_view()
but its get success for just one block display of taxonews blocks - if more that one all blocks title will link to latest block link value :(
any suggestion
thank you

#3

fgm - June 10, 2009 - 15:35

This might be because you don't differentiate on the block delta.

#4

math_1048 - June 10, 2009 - 18:23

yes, you get right, and its works now :)
my modification on _preprocess_block(&$vars)
was:

if (isset($vars['block']->module) && ($vars['block']->module == 'taxonews')) {
   
       $vars['block']->subject = l($vars['block']->subject, 'taxonomy/term/'.$taxonews_block_title[$vars['block']->delta]->tid,array('absolute' => TRUE));
  }

and on theme_taxonews_block_view()
was:
+  global $taxonews_block_title;
    ............................................................................
    if (variable_get(Taxonews::VAR_SHOW_ARCHIVE, TRUE))
      {

+      $taxonews_block_title["$delta"]->tid=$tid;

      $ret .= '<span class="more-link">'
           .  l(t('Archive'), "taxonomy/term/$tid", array('absolute' => TRUE))
           .  '</span> ' ;
      }

thank you very much
best regards

#5

fgm - June 11, 2009 - 05:49
Status:needs review» fixed

Glad it works.

#6

System Message - June 25, 2009 - 05:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.