Drupal-7 rss 提要图标到文本
Drupal-7 rss feed icon to text
我正在寻找一种方法来将默认的视图提要图标从图像修改为文本值。我发现了几种情况,人们将默认图像更改为新图像,但我更喜欢使用字体,因为无论分辨率或设备如何,它们看起来都更清晰。
想法是用 FontAwesome 图标 (fa-rss-square, ) 替换图像。我已成功更改搜索块中的默认文本,即:
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 及其 class,但里面只有 font/text link,最好没有相同的 class .我将不胜感激任何聪明的建议:-)
您可以避免从 php 打印提要图标,只需在 UI
视图的页脚或页眉中输入 html 代码
或
您可以通过 CSS 隐藏图像,并使用
.feed-icon:before {
font-family: FontAwesome;
content: "\f143";
}
我正在寻找一种方法来将默认的视图提要图标从图像修改为文本值。我发现了几种情况,人们将默认图像更改为新图像,但我更喜欢使用字体,因为无论分辨率或设备如何,它们看起来都更清晰。
想法是用 FontAwesome 图标 (fa-rss-square, ) 替换图像。我已成功更改搜索块中的默认文本,即:
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 及其 class,但里面只有 font/text link,最好没有相同的 class .我将不胜感激任何聪明的建议:-)
您可以避免从 php 打印提要图标,只需在 UI
视图的页脚或页眉中输入 html 代码或
您可以通过 CSS 隐藏图像,并使用
.feed-icon:before {
font-family: FontAwesome;
content: "\f143";
}