Drupal 中如何更改用户登录框(User Login Box)的主题样式

要对 Drupal 的用户登录框样式进行更改,需要执行以下两步

  1. 在模板函数文件 template.php 中新建 MYTHEME_theme() 函数,用于实现登录框的主题化
  2. 新建 user-login-block.tpl.php 模板文件,用于定义登录框的样式(即 HTML 模版)

向 template.php 文件中添加的 MYTHEME_theme() 函数如下:

<?php
/**
* This snippet will register a theme implementation of the user login form.
*
* Drupal 6.x only!
* Replace 'mytheme' with the name of your theme.
*/
function MYTHEME_theme(){
  return array(
    
'user_login_block' => array(
      
'template' => 'user-login-block',
      
'arguments' => array('form' => NULL),
    )
  );
}
?>

user-login-block.tpl.php 模板文件的参考代码可参考 http://drupal.org/node/478328

 

参考文档:Theme User Login Box

相关文档:Create a custom user login bar


付费阅读