Theming Form User Interface untuk Client - Profile edit

Events happening in the community are now at Drupal community events on www.drupal.org.
Develcode's picture

Posting Ke empat aku ingin Sharing bagaimana Tehnik mentheming Profil Edit user.

Langkah langkah nya gampang, kali ini aku tidak akan menulis Preprocess pada Templates.php !

Pertama buka Templates.php kamu dan insert Hook Baru di sana seperti ini

<?php

function Thememu_theme($existing, $type, $theme, $path){

  return array(
   
'user_profile_form' => array(
     
// Forms always take the form argument.
     
'arguments' => array('form' => NULL),
     
'template' => 'user-profile-edit',
    ),


}

?>

Oke Kita bedah Code di atas

'user_profile_form' => array(
'arguments' => array('form' => NULL),

mengidentifikasikan akan di ambil nya argument dari user.module pada folder core drupal anda folder site mu/Modules/user

'template' => 'user-profile-edit',

ini berfungsi untuk meng overide fungsi daru user.modules menjadi fungsi fungsi yang anda kehendaki dan tentunya bisa di markup dengan xhtml ---> menjadi file user-profile-edit.tpl.php

-------------------------------------------------------------------------------------------

Langkah kedua buat file user-profile-edit.tpl.php dan save di folder sites/themes/theme mu

dan ikuti code berikut ini

<?php

<h2>complete your resume in webs page</h2>
<!--
Let's print the form's XHTML -->

<?
php print drupal_render($form['account']['name']); ?>


<?php print drupal_render($form['account']['mail']); ?>

<?php print drupal_render($form['account']['pass']); ?>

<?php print drupal_render($form['account']['status']); ?>

<?php print drupal_render($form['picture']['current_picture']); ?>

<?php print drupal_render($form['picture']['picture_delete']); ?>

<?php print drupal_render($form['picture']['picture_upload']); ?>

<?php print drupal_render($form['contact']); ?>

<?php print drupal_render($form['timezone']); ?>


<?php

   
/**
      * Rename The Buttons !
    */
   
$form['submit']['#value'] = t('Save & Changes your Profile');
   
$form['delete']['#value'] = t('Destroy Your-self');


 
// That's where $form_markup for implementasi $form
 
print drupal_render($form);
?>


<?php print drupal_render($form['submit']); // print the submit button ?>


?>

ok kita akan kupas satu satu,

<?php

<?php print drupal_render($form['account']['name']); ?>


<?php print drupal_render($form['account']['mail']); ?>

<?php print drupal_render($form['account']['pass']); ?>

<?php print drupal_render($form['account']['status']); ?>

<?php print drupal_render($form['picture']['current_picture']); ?>

<?php print drupal_render($form['picture']['picture_delete']); ?>

<?php print drupal_render($form['picture']['picture_upload']); ?>

<?php print drupal_render($form['contact']); ?>

<?php print drupal_render($form['timezone']); ?>

<?php print drupal_render($form['submit']); // print the submit button ?>

?>

untuk mengeprint form form anda, anda bisa memakai Devel modules, tapi aku lebih seneng melihat struktur user.module, tapi terserah kalian saja enak nya gimana.

<?php

   
/**
      * Rename The Buttons !
    */
   
$form['submit']['#value'] = t('Save & Changes your Profile');
   
$form['delete']['#value'] = t('Destroy Your-self');


 
// That's where $form_markup for implementasi $form
 
print drupal_render($form);
?>


<?php print drupal_render($form['submit']); // print the submit button ?>


?>

ini berfungsi untuk menulis fungsi fungsi php anda , atau meng overide user.modules

sekarang sudah selesai , anda dapat sesuka hati menggambar html di sini ... ---> ehhh jangan lupa clear the cache nya ya.

Ehhh iya ----> jika kalian akan mentheming juga form form dari modules core Profile , anda perlu membuat hooks baru lagi atau jika ingin form form dari modules Profile anda ter print di halaman Profil/edit bisa di gunakan module onepageprofile , link nya males nyari aku tapi pokok nya nama nya itu , dan ini contoh untuk untuk print form nya .

<?php print drupal_render($form['category_form']['profile_fieldform_kamu']); ?>

okehhh sekian Trik singkat ini , semoga berguna dan menjadi referensi saudara saudara sekalian.