2012-10-24 33 views
0

我有一個菜單建立了這個whay:添加rel和在菜單項title屬性編程

function hook_menu() 
{ 
    $items['footer_callback'] = array(
     'type' => MENU_CALLBACK, 
     'access callback' => true, 
     'page callback' => 'drupal_get_form', 
     'page arguments' => array('tac_webforms_footer_form'), 
     'menu_name' => 'footer-menu', 
     'title' => 'Newsletter' 
    ); 
} 

有什麼辦法,我可以通過類似的options屬性添加reltitle HTML屬性創建<a>標籤 ?

根據docs,我可以通過我所說的options密鑰,但這不起作用。

P.S:我想這樣做編程,perferably無需使用任何模塊,

回答

0

這將添加標題屬性的主題水平最鏈接,取決於一些模塊雖然。也許你可以與rel屬性相同。

/** 
* Add title attribute to any link that doesnt have a title already 
*/ 
function YOURTHEME_preprocess_link(&$vars) { 
    // If title set and not empty dont do anything 
    if (isset($vars['options']['attributes']['title']) && !empty($vars['options']['attributes']['title'])) { 
     return; 
    } 

    // Use the link text as the title 
    $vars['options']['attributes']['title'] = strip_tags($vars['text']); 
} 
+0

菜單鏈接不在'$ vars'數組中......任何其他可能包含它們的鉤子? –