Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 7 向drupal 7选项卡添加类_Drupal 7 - Fatal编程技术网

Drupal 7 向drupal 7选项卡添加类

Drupal 7 向drupal 7选项卡添加类,drupal-7,Drupal 7,我试图向drupal7的主选项卡元素添加两个类。我试图通过将以下内容添加到我的template.php来覆盖主题菜单本地任务: function {{proj}}_menu_local_tasks(&$variables) { $output = ''; if (!empty($variables['primary'])) { $variables['primary']['#prefix'] = '<h2 class="element-invisible">

我试图向drupal7的主选项卡元素添加两个类。我试图通过将以下内容添加到我的template.php来覆盖主题菜单本地任务:

function {{proj}}_menu_local_tasks(&$variables) {
  $output = '';

  if (!empty($variables['primary'])) {
    $variables['primary']['#prefix'] = '<h2 class="element-invisible">' . t('Primary tabs') . '</h2>';
    $variables['primary']['#prefix'] .= '<ul class="nav nav-tabs">';
    $variables['primary']['#suffix'] = '</ul>';
    $output .= drupal_render($variables['primary']);
  }
  if (!empty($variables['secondary'])) {
    $variables['secondary']['#prefix'] = '<h2 class="element-invisible">' . t('Secondary tabs') . '</h2>';
    $variables['secondary']['#prefix'] .= '<ul class="nav nav-tabs">';
    $variables['secondary']['#suffix'] = '</ul>';
    $output .= drupal_render($variables['secondary']);
  }

  return theme_menu_local_tasks($variables);
}
函数{{proj}}菜单{u本地}任务(&$variables){
$output='';
如果(!empty($variables['primary'])){
$variables['primary']['#prefix']='.t('primary tabs');
$variables['primary']['#prefix'].='
    ; $variables['primary']['#后缀']='
'; $output.=drupal_render($variables['primary']); } 如果(!empty($variables['secondary'])){ $variables['secondary']['#prefix']='.t('secondary tabs'); $variables['secondary']['#prefix'].='
    ; $variables['secondary']['#后缀']='
'; $output.=drupal_render($variables['secondary']); } 返回主题菜单本地任务($variables); }

尽管如此,这似乎从未被称为。我做错了什么?

我在template.php中添加了以下函数,并在页面模板中调用了它或render($tabs):

function {{proj}}_render_nav_tabs() {
    $output = '';

    if ($primary = menu_primary_local_tasks()) {
        $output .= '<ul class="nav nav-tabs space-bottom">' . drupal_render($primary) . '</ul>';
    }

    if ($secondary = menu_secondary_local_tasks()) {
        $output .= '<ul class="nav nav-tabs space-bottom">' . drupal_render($secondary) .'</ul>';
    }

    return $output;
}
函数{{proj}}\u render\u nav\u tabs(){
$output='';
如果($primary=menu\u primary\u local\u tasks()){
$output.='
    '。drupal_渲染($primary)。
; } 如果($secondary=menu\u secondary\u local\u tasks()){ $output.='
    '。drupal_渲染($secondary)。
; } 返回$output; }