Widgets

順利將一些 HTML/CSS/JS template 整合進去 Drupal 7 Theme 之後,接下來的微調工作就從 Login Form、user/register page 開始囉。

user/register page 有個很不錯的資源是 <Converting 6.x modules to 7.x> (該頁面還在編修中,內容很多很長),裡頭有一段提到 "hook_user_form(), hook_user_register() are gone"。以前 Drupal 6 使用 User API 來做處理,現在改用 Form API 處理。

Login Form 的一些參考改法,這一篇 <How to customize the user login/pw/reset blocks in Drupal 7?> 的註解,可以參考看看。以下程式碼放個備份,在你的 theme 目錄中的 template.php 做修改。


function YOURTHEME_form_alter(&$form, &$form_state, $form_id) {

	if ($form_id == "user_login_block") {
		$form['links'] = Null; // Remove Request New Password and other links from Block form
		//$form['links']['#markup'] = t('Not Registerd?') . ' ' . t('Create Account') . ''; // Remove Request New Password from Block form
		$form['links']['#markup'] = ' ' . t('註冊') . ''; // Remove Request New Password from Block form
		$form['name']['#title'] = t("E-mail"); // Change text on form
	}
    
}



Brought to you by

0 Comments:

Post a Comment

 
Top