2016-01-22 70 views
0

我正在尋找一種方法來修改從圖像默認瀏覽飼料圖標,文本值。我發現幾種情況下,人們將默認圖像更改爲新圖像,但我更喜歡使用字體,因爲無論分辨率或設備如何,它們看起來都更加清晰。Drupal的7 RSS feed圖標文本

這個想法是用FontAwesome圖標替換圖像(fa-rss-square,&#xf143)。我曾更迭與搜索塊更改默認文本,即:

function theme_form_alter(&$form, &$form_state, $form_id) { 
    if($form_id == 'search_block_form') { 
    $form['actions']['submit']['#value'] = decode_entities(''); 
    } 
} 

我是一個新手,當涉及到PHP的,所以我改變了鉤的企圖Drupal的API中解釋了不工作(到目前爲止):

function theme_feed_icon($variables) { 
    $text = t('Subscribe to !feed-title', array('!feed-title' => $variables['title'])); 
    if ($image = theme('image', array('path' => 'misc/feed.png', 'width' => 16, 'height' => 16, 'alt' => $text))) { 
    return l($image, $variables['url'], array('html' => TRUE, 'attributes' => array('class' => array('feed-icon'), 'title' => $text))); 
    } 
} 

電流輸出看起來是這樣的:

<div class="feed-icon"> 
     <a href="mywebsite/news/rss" class="feed-icon" title="Subscribe to News from my website"><img typeof="foaf:Image" src="mywebsite/misc/feed.png" width="16" height="16" alt="Subscribe to news from my website"></a> 
</div> 

我想保持div和它的類,但只有字體/文本鏈接裏面,最好沒有相同的分類秒。我會很感激任何聰明的建議:-)

回答

0

你能避免打印從PHP飼料圖標,只需輸入HTML代碼或者在頁腳或視圖從UI

你可以通過CSS隱藏圖像,並使用

.feed-icon:before { 
font-family: FontAwesome; 
content: "\f143"; 
} 
+0

頁腳或頁眉用於自定義標記tekst是一個很好的主意。感謝您的建議:) – moby