0
votes

Hia

I am using the following in a custom module to customise the form on the node/add/baby page for my BABY content type, however i want to make some slight modifications to this page when its the node/nid/edit page for the baby content type. is this possible?

<code>
<?php
function concept_theme() {
  return array(
    'baby_node_form' => array(
      'arguments' => array(
          'form' => NULL,
      ),
      'template' => 'templates/baby-node-form',
      'render element' => 'form',
    ),
  );
}
?>
</code>

thank u

2

2 Answers

2
votes

In template.php

function my_theme_name_theme($existing, $type, $theme, $path)
$hooks['baby_node_form']=array(
    'render element'=>'form',
    'template'      =>'templates/node--baby-edit',
);
return $hooks;
}

In node--baby-edit.tpl.php

Hide fields like this:

<?php hide($form['title']); ?>

Manipulate fields like this:

<?php print render($form['field_image']); ?>

Use this to print all/rest of content:

<?php print drupal_render_children($form); ?>

Clear cache.

1
votes

You can alter the node creation form by implementing this hook, something similar to this:

hook_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'node_baby_form') {
     //do modification to form array $form
  }
}

Or if your node is defined by hook_node_info (which I believe is not the case), just changing the elements in hook_form()