Drupal 7 Drupal钩子主题错误
我正在尝试将自定义主题应用于单个页面。该页面是我使用hook_菜单设置的页面。 我已经实现了hook_主题,但当我刷新网站时,出现以下错误: 致命错误:第1044行的/srv/bindings/baf029321aa248e5907866cc7de3a6d6/code/includes/form.inc中的操作数类型不受支持 以下是我的代码:Drupal 7 Drupal钩子主题错误,drupal-7,hook-theme,Drupal 7,Hook Theme,我正在尝试将自定义主题应用于单个页面。该页面是我使用hook_菜单设置的页面。 我已经实现了hook_主题,但当我刷新网站时,出现以下错误: 致命错误:第1044行的/srv/bindings/baf029321aa248e5907866cc7de3a6d6/code/includes/form.inc中的操作数类型不受支持 以下是我的代码: function mymodule_menu(){ $items['mymodule'] = array( 'title' =&g
function mymodule_menu(){
$items['mymodule'] = array(
'title' => 'My-module',
'page callback' => 'drupal_get_form',
'page arguments' => array('mymodule_admin_page'),
'access arguments' => array('access content'),
);
return $items;
}
function mymodule_admin_page(){
drupal_set_message('My-module admin page responding');
return theme('mymodule_template');
}
function mymodule_theme($existing, $type, $theme, $path){
drupal_set_message('My-module theme hook responding');
return array(
'mymodule_template' => array(
#'render element' => 'elements',
'template' => 'mytemplate',
'path' => drupal_get_path('module', 'mymodule') . '/templates',
)
);
}
据我所知,当我将正斜杠添加到'path'=>drupal\u get\u path('module','mymodule')时,就会发生错误/模板',
。
如果我删除斜杠,错误就会消失,但随后,系统尝试查找mytemplate.tpl.php失败,因为它正在查看mymodule/templatemytemplate.tpl.php
试试这个。。。
此菜单总是调用窗体函数,而不是调用主题函数
$items['mymodule'] = array(
'title' => 'My-module',
'page callback' => 'drupal_get_form',//this is use a get the form
'page arguments' => array('contactform_form'),// this is use a name of form
'access arguments' => array('access content'),
);
function contactform_form($form, &$form_state)
{
//write a form attributes
}
移动drupal\u获取路径('module','mymodule')。'/将模板“
转换为另一个变量,然后在“”路径“=>$myVariable”中使用它