1
마지막으로 프로젝트를 위해 드루팔 (Drupal 8)에 뛰어 들고 있습니다. 내 모듈에서는 경로를 기반으로하는 모듈에서 템플릿을 렌더링하는 방법을 결정할 수 없습니다.Drupal 8 hook_theme() 렌더링을위한 hook_menu()
드루팔 7에서 나는 보통이
custom.module에게
function union_views_menu() {
$items = array();
$items['home'] = array(
'title' => 'Home',
'description' => 'home apge',
'page callback' => 'home_page',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK
);
return $items;
}
function home_page() {
return theme('home_page');
}
function union_views_theme(){
return array(
'home_page' => array(
'template' => 'templates/home-page'
)
);
}
할 것 그리고 내가 템플릿에서 템플릿 폴더를 것
내가 가진 드루팔 8을약 여기까지 :
custom.routing.yml
custom:
path: /home
defaults:
_controller: Drupal\custom\Controller\CustomController::custom
requirements:
_permission: 'access content'
SRC/컨트롤러/CustomController.php
namespace Drupal\custom\Controller;
class CustomController {
public function custom(){
return array(
'#title' => 'Custom Theme',
'#markup' => 'This is a content.'
);
}
}
을 그리고 경로에 도착하기에 좋은 모든 작품. 하지만 callback으로 사용할 hook_menu에 대한 hook_theme 함수를 만드는 것을 알아낼 수 없습니다.
'#theme' => 'home_page'
: