Saturday, September 19, 2009

Theme a CCK node content type input form in Drupal 6

<?php
function myModule_cck_node_type_name_theme() {
  return array(
    'cck_node_type_name_node_form' => array(
      'arguments' => array('form' => NULL),
      //'file' => 'user.admin.inc',
      //'template' => 'ccktype', // you can also use template to theme the node form.
    ),
  );
}

function theme_cck_node_type_name_node_form($form) {
  $output = '';
  $buttons = '';

  foreach (element_children($form) as $key) {
    if ($key == 'buttons') {
      $buttons = drupal_render($form[$key]);
    }
    else {
      $output .= '' . drupal_render($form[$key]) . '';
    }
  }

  $output .= $buttons . '';

  $output .= 'add more stuff here';

  return $output;
}

No comments: