我是drupal的新手,我需要呈现一个表单,所以我必须实现钩子主题,我的困惑是在Drupal8中我应该在哪个目录下创建钩子主题文件?
// my_module.module
function custom_module_theme($existing, $type, $theme, $path) {
return array(
'customize_form' => array(
'variables' => array(
'Custom_Form' => NULL
),
'render element' => 'form'
),
);
}在Drupal8中我必须把上面的文件放在哪里??
提前谢谢。
发布于 2018-10-17 19:23:58
在.module文件中
File location - module/custom/MODULENAME/MODULENAME.module
/**
* @file
* Twig template for render content
*/
function MODULENAME_theme($existing, $type, $theme, $path) {
return [
'theme_name_template' => [
'variables' => ['flag' => NULL],
],
];
}
To Use theme function use below code
return ['#theme' => 'theme_name_template', '#flag' => 1];发布于 2017-12-10 04:22:06
如果我没弄错的话,你想让这个文件夹放入你的模块,对吧?您必须将模块放在/modules/custom/your_module_folder或/sites/all/modules/your_module_folder下的文件夹中
https://stackoverflow.com/questions/47725509
复制相似问题