Saturday, July 27, 2024
HomeDeveloperTheming Node Form into Regions in Drupal 6

Theming Node Form into Regions in Drupal 6

Date:

Related stories

Play Crazy Time and Win Big

Crazy Time is an exciting live casino game that...

Exploring the Excitement of Online Gaming: A Comprehensive Guide

Online gaming has rapidly evolved into one of the...

Starzbet APP: Features and User Experience

In the rapidly evolving landscape of online betting, accessibility...

Hassle-Free Starzbet Giriş: Start Betting Instantly

Starzbet Giriş, or login, is your gateway to a...

Get the Latest Updates on Starzbet Twitter

In the fast-paced world of online gaming and betting,...
spot_img

This is one of the cases, I needed to change the layout of node add form. This snippet shows us how to theme one node type add form. Originally I inspired the solution from Development Seed’s theme, rubik.

Let’s suppose our node type is “TYPE”, and theme name is “custom_theme”. The template page is located in themes/custom_theme/templates/node-TYPE-form.tpl.php.
First of all, define hook_theme() in your theme’s template.php.

<?php
/**
 * Implementation of hook_theme().
 */
function custom_theme_theme() {
  $items = array();
  $items['TYPE_node_form'] = array(
    'arguments' => array('form' => array()),
    'path' => drupal_get_path('theme', 'custom_theme') . '/templates',
    'template' => 'node-TYPE-form',
    'preprocess functions' => array(
      'custom_theme_preprocess_TYPE_form'
    )
  );

  return $items;
}
?>

Now implement the preprocess handler. We want to divide the form into two columns, main form in left sidebar, and taxonomy in right sidebar. As footer We will print the buttons.

<?php
function custom_theme_preprocess_TYPE_form(&$vars) {
  // Copy taxonomy and buttons from $form to $vars, to pass them to the template file.
  $vars['sidebar'] = $vars['form']['taxonomy'];
  $vars['buttons'] = $vars['form']['buttons'];
 
  // Remove taxonomy and buttons, from $form ( no duplication ).
  unset($vars['form']['taxonomy']);
  unset($vars['form']['buttons']);
}
?>

After that, create the template page, where you will use drupal_render() function.
In or case the template page will be: themes/custom_theme/templates/node-TYPE-form.tpl.php. And its code :

  
    <?php if($sidebar): ?>
      <?php print drupal_render($sidebar); ?>
    <?php endif; ?>
  
  
    <?php if($form): ?>
      <?php print drupal_render($form); ?>
    <?php endif; ?>
    
    <?php if($buttons): ?>
      
        <?php print drupal_render($buttons); ?>
    
  <?php endif; ?>
  
  

Finally, create your own CSS styling 🙂

Latest stories

spot_img
sabung ayam online
slot mahjong
akun pro jepang
https://sipita.akmt.ac.id/ttd/jmw/
https://akmt.ac.id/wp-content/plugins/cas/
https://akmt.ac.id/wp-content/plugins/caq/
https://sta-afc-ob.com/wp-content/uploads/2020/
https://sta-afc-ob.com/wp-content/uploads/2020/xgacor/
http://unitycolleges.co.in/1_2_1/terbaru/
https://diabeticregulator.com/images/joker/
https://kodimariimpex.com/img/slot-online/
https://mynasolutions.com/includes/gampang-menang/
https://perpustakaan.ithb.ac.id/files/chat/
https://gosyensejahterautama.co.id/core/vendor/split/
https://gosyensejahterautama.co.id/core/vendor/lan/
https://lp2m.akmt.ac.id/-/xgacor/
https://phys.unpad.ac.id/wp-content/languages/
https://mbig.bakrie.ac.id/config/-/max/
https://mbig.bakrie.ac.id/error/-/xbitxx/
https://ma.arrahmat-majalengka.sch.id/lib/ws168/
https://ma.arrahmat-majalengka.sch.id/lib/mix/
https://elearning.smpn2jayapura.sch.id/-/xgacor/
https://event.potensiaskill.com/defe/
https://event.potensiaskill.com/ceo/
https://blueedenscraptrading.com/zuu/
https://infinitotravel.com.ar/
https://laotomana.com.ar/
https://portal.stiemadani.ac.id/vendor/lib/mix/
https://portal.stiemadani.ac.id/vendor/lib/hitam/
TANGKASNET/
AKUN PRO PLATINUM
https://rajawalitanjungsari.com
sv388
casino online
agen sbobet
sabung ayam online
mahjong ways 2
scatter hitam
slot thailand
slot thailand
indobola77
indobola77
sabung ayam online
slot777
slot gacor
indomax88
indomax88
slot gacor
bandar303
bandar303
bandar303
Juara303
indobit88
master303 slot
master303 slot
Scatter Hitam
sabung ayam online
slot gacor
bola gacor
akun pro thailand
Sabung Ayam Online
Slot777
Ws168
https://sma1polanharjo.sch.id/
Casino Online
https://realcount-bundaenie.com/
https://operator-bsnpgkotabekasi.com/
https://bsnpgkotabekasi.com/
slot thailand
sv388
sabung ayam online
sv388
sabung ayam online
slot gacor
slot zeus
https://ela.p3tik.unisma.ac.id/
sbobet
sv388
sbobet
Zeus Slot
Akun Jp
Zeus Slot
Slot Thailand
Scatter Hitam
Slot777
Sv388
Akun Demo Slot