0

私はこのように構築されたメニューを持っています:

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に追加する属性reltitlehtml 属性のようなものを渡す方法はありますか?<a>

docsによると、options私が話していたキーを渡すことはできますが、うまくいきません。

PS:モジュールを使用せずに、できればプログラムで実行したいと思います。

4

1 に答える 1

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']);
}
于 2012-10-24T15:06:32.157 に答える