2013-08-26 2 views
0

저는 Drupal 및 Drupal 테마 개발에 익숙하지 않습니다. Drupal 템플릿을 오버라이드하는 법을 배우고 나면, 나는 drupal 7 테마 기능을 오버라이드 (override)하는 법을 알고 싶었다. 노드 Using the theme layer에서 다음 일이 내가 배운 :Drupal 7 테마 기능 무시

  1. 을 모듈의 모든 후크를 들어, 우리는
  2. 임 plementation는 후크 함수를 등록해야하는 '템플릿'파일 그것의 반환 배열에 정의되어있는 경우 함수. 기타 구현은 기능을 통해 이루어진다.

이제 테마 기능을 1. 복사를 대체 할 책 A definative guide to Drupal 7을, 다음 - 내 테마의 template.php 파일 2. 변경 yourtheme_ 3. 저장 에 theme_에서 파일 이름의 시작 부분에 테마 기능을 붙여 내가 comment.module에 테마 기능 comment_help()을 무시하려면 지금

function theme_more_link($variables) { 
    return '<div class="more-link">' . l(t('More'), $variables['url'], array('attributes' => array('title' => $variables['title']))) . '</div>'; 
} 

: 예를 제공하기 위해, 다음과 같은 기능을 무시

function comment_help($path, $arg) { 
    switch ($path) { 
    case 'admin/help#comment': 
     $output = '<h3>' . t('About') . '</h3>'; 
     $output .= '<p>' . t('The Comment module allows users to comment on site content, set commenting defaults and permissions, and moderate comments. For more information, see the online handbook entry for <a href="@comment">Comment module</a>.', array('@comment' => 'http://drupal.org/documentation/modules/comment/')) . '</p>'; 
     $output .= '<h3>' . t('Uses') . '</h3>'; 
     $output .= '<dl>'; 
     $output .= '<dt>' . t('Default and custom settings') . '</dt>'; 
     $output .= '<dd>' . t("Each <a href='@content-type'>content type</a> can have its own default comment settings configured as: <em>Open</em> to allow new comments, <em>Hidden</em> to hide existing comments and prevent new comments, or <em>Closed</em> to view existing comments, but prevent new comments. These defaults will apply to all new content created (changes to the settings on existing content must be done manually). Other comment settings can also be customized per content type, and can be overridden for any given item of content. When a comment has no replies, it remains editable by its author, as long as the author has a user account and is logged in.", array('@content-type' => url('admin/structure/types'))) . '</dd>'; 
     $output .= '<dt>' . t('Comment approval') . '</dt>'; 
     $output .= '<dd>' . t("Comments from users who have the <em>Skip comment approval</em> permission are published immediately. All other comments are placed in the <a href='@comment-approval'>Unapproved comments</a> queue, until a user who has permission to <em>Administer comments</em> publishes or deletes them. Published comments can be bulk managed on the <a href='@admin-comment'>Published comments</a> administration page.", array('@comment-approval' => url('admin/content/comment/approval'), '@admin-comment' => url('admin/content/comment'))) . '</dd>'; 
     $output .= '</dl>'; 
     return $output; 
    } 
} 

어떻게하면됩니까? 그 이름은 theme_에서 시작하지 않습니다.

답변

1

코어 주석 모듈이 기능을 향상시키고 있습니다. hook_help. 사용자 정의 모듈에서 동일한 기능을 사용해야합니다. $output = "";

+0

@Nitish를 사용하여 $ 출력 데이터를 먼저 정리해야합니다.이 대답이 문제를 해결 했습니까? 그렇다면 피드백을주세요 (upvote, 받아 들일 수있는 것으로 선택하십시오). – TheodorosPloumis

관련 문제