2014-02-25 2 views
4

콘텐츠 유형을 만들었으며 모두 세로 탭 인 약 5 개의 그룹이 있습니다.Drupal 7은 내 콘텐츠 유형의 그룹화 된 각 섹션에 제목을 추가합니까?

어떤 이유로 필드 그룹 레이블이 세로 탭에 대해 작동하지 않습니다. <h2> 태그는 항상 : <h2 class="element-invisible">Vertical Tabs</h2>입니다. 제목은 manage fields에 관계없이 항상 Vertical Tabs이며, 항상 클래스가 있습니다. element-invisible

세로 탭을 사용하는 일부 테마에서는 똑같은 것으로 나타났습니다.

또한이 테마에는 각 세로 탭 위에 추가 제목 태그가 표시되어 해당 그룹의 제목이 표시됩니다. (adaptivetheme)이 좋은 예입니다.

어쨌든, 실제 질문에 ....

어떻게 내 콘텐츠 형식의 각 그룹화 섹션 제목 (수직 탭)를 추가하는 방법은 무엇입니까?

주 :이 디스플레이 작성한 콘텐츠 콘텐츠를 추가하지 대한 실제 양식이다.

이 문제에 대한 도움은 매우 중요합니다.

+0

콘텐츠 유형별로 노드를 테마 화하는 방법에 대한 정보는 https://drupal.org/node/17565를 참조하십시오. –

+0

확실히 보이지 않는 제목 외에 각 그룹에 다른 제목을 추가하거나 보이지 않는 제목을 보시겠습니까? 두 번째 부분 인 경우 @nmc 응답 및 템플릿 파일에 동의합니다. – Djouuuuh

+0

감사합니다 @ justinelejeune하지만 각 그룹에 제목을 어떻게 추가합니까? 나는 그 옵션을 보지 못했다 ... 사용자가 내용을 추가 할 수있는 필드. – Cybercampbell

답변

1

콘텐츠 유형에 제목을 추가하려면 Drupal 7 content theming을 사용하십시오. 콘텐츠 유형이 명명 된 경우 예를 들어, 는 mycontent 다음 테마의 폴더에 다음 스크립트를 만들기 :에

function mycontent_preprocess_page(&$vars) { 
    if (isset($vars['node']->type)) { 
     $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type; 
    } 
} 

추가 정보 : 콘텐츠 형식은 다음과 같은 기능을 사용하여 사전 처리

{theme path}/page--node--mycontent.tpl.php 

template_preprocess_page 함수를 사용할 수 있습니다 here

+0

안녕하세요, 응답 주셔서 감사하지만 이것은 실제 양식에 대한 내용을 추가하기위한 콘텐츠를 표시하지 않습니다. 다른 아이디어? – Cybercampbell

1

테마의 template.php 또는 사용자 정의 모듈에서 컨텐츠 유형 양식을 사용자 정의 할 수 있습니다. 이 문서는 here에 설명되어 있습니다. 사용자 지정 콘텐츠 형식을 기사를 사용하여 테마 인 MyModule에서 사용자 지정 모듈이있는 경우 예를 들어, 당신은과 같이 사용자 정의 할 수 있습니다 출력하려면

<?php 
/** 
* Implements hook_theme(). 
*/ 
function MYMODULE_theme($existing, $type, $theme, $path) { 
    return array(
    'article_node_form' => array(
     'render element' => 'form', 
     'template' => 'article-node-form', 
     // this will set to module/theme path by default: 
     'path' => drupal_get_path('module', 'MYMODULE'), 
    ), 
); 
} 
?> 

사용자 정의 데이터 :

<?php 
/** 
* Preprocessor for theme('article_node_form'). 
*/ 
function template_preprocess_article_node_form(&$variables) { 
    // nodeformcols is an alternative for this solution. 
    if (!module_exists('nodeformcols')) { 
    $variables['sidebar'] = array(); // Put taxonomy fields in sidebar. 
    $variables['sidebar'][] = $variables['form']['field_tags']; 
    hide($variables['form']['field_tags']); 
    // Extract the form buttons, and put them in independent variable. 
    $variables['buttons'] = $variables['form']['actions']; 
    hide($variables['form']['actions']); 
    } 
} 
?> 
1

다른 이 질문에 대한 답은 올바른 방향이었습니다. 수직 탭 표제를 담당하는 코드는 파일에있는 theme_vertical_tabs 함수입니다. 당신이 당신의 자신의 테마가있는 경우

, 당신은 복사하여 재정의 테마의 template.php 파일에이 기능을 변경할 수 있습니다 :

function YOUR_THEME_NAME_vertical_tabs($variables) { 
    $element = $variables['element']; 

    // Add required JavaScript and Stylesheet. 
    drupal_add_library('system', 'drupal.vertical-tabs'); 

    // Following line changed to use title set in field settings and remove class="element-invisible 
    $output = '<h2>' . t($element['#title']) . '</h2>'; 
    $output .= '<div class="vertical-tabs-panes">' . $element['#children'] . '</div>'; 

    return $output; 
} 

당신이 수직 탭 제목을 찾고 있다면이 내용에 표시 관리 화면이 있고 관리자 테마가 설정되어 있으면 위의 수정 사항을 관리자 테마에 적용해야합니다.

관련 문제