コード例 #1
0
ファイル: template.php プロジェクト: edwardpku/Atrium
/**
 * Add an href-based class to links for themers to implement icons.
 */
function ginkgo_icon_links(&$links)
{
    if (!empty($links)) {
        foreach ($links as $k => $v) {
            if (empty($v['attributes'])) {
                $v['attributes'] = array('class' => '');
            } else {
                if (empty($v['attributes']['class'])) {
                    $v['attributes']['class'] = '';
                }
            }
            $v['attributes']['class'] .= ' icon-' . seed_id_safe(drupal_get_path_alias($v['href']));
            $v['title'] = "<span class='icon'></span><span class='label'>" . $v['title'] . "</span>";
            $v['html'] = true;
            $links[$k] = $v;
        }
    }
}
コード例 #2
0
ファイル: template.php プロジェクト: snarlydwarf/ginkgo
/**
 * Add an href-based class to links for themers to implement icons.
 */
function ginkgo_icon_links(&$links)
{
    if (!empty($links)) {
        foreach ($links as $k => $v) {
            if (empty($v['attributes'])) {
                $v['attributes'] = array('class' => '');
            } else {
                if (empty($v['attributes']['class'])) {
                    $v['attributes']['class'] = '';
                }
            }
            $v['attributes']['class'] .= ' icon-' . seed_id_safe(drupal_get_path_alias($v['href']));
            // Detect and replace counter occurrences with markup.
            $start = strpos($v['title'], '(');
            $end = strpos($v['title'], ')');
            if ($start !== FALSE && $end !== FALSE && $start < $end) {
                $v['title'] = strtr($v['title'], array('(' => "<span class='count'>", ')' => "</span>"));
            }
            $v['title'] = "<span class='icon'></span><span class='label'>" . $v['title'] . "</span>";
            $v['html'] = true;
            $links[$k] = $v;
        }
    }
}