views:

69

answers:

3

I have enabled taxonomies in the form of Tag, and I would like the tag field to show up below the content when users are editing the page. Where would I make that setting change?

A: 

This is a sample from one of the node.tpl.php files in the themes/ directory.

<div class="taxonomy"><?php print $terms?></div>

If you move that code below

<div class="content"><?php print $content?></div>

It should work.

Assuming I've understood your question correctly!

Rimian
Oh no, you mean edit. Sorry, my bad.
Rimian
Yeah, to clarify for others reading, the tags are showing up below the article on VIEW, but I want the taxonomy section to show up below the content on EDIT.
Lloyd
+1  A: 

You'll need to implement hook_form_alter() within a custom module to adjust the weights of the node edit form fields:

/**
 *  Implementation of hook_form_alter().
 */
function yourModule_form_alter(&$form, $form_state, $form_id) {
  // Is this a node edit form?
  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
    // Yes, adjust taxonomy weight to push it to bottom of form
    $form['taxonomy']['#weight'] = 42; // TODO: Find appropriate number by inspecting the other form element weights
  }
}

Edit: As bmann pointed out in a separate answer, this is not necessary if you have installed the CCK module on your site, as it adds a configuration option for the field order under 'admin > content types > manage fields'.

Henrik Opel
Could you point me towards some references on doing this?
Lloyd
I worked through the first few pages of the Drupal tutorial. Made a tagsbelowonedit.info and tagsbelowonedit.module. Installed via /admin/modules and it works perfect. Thanks!
Lloyd
@Lloyd: For minor fixes like this, I usually implement a module named after the site, not the fix - that way I have distinct place to accumulate the other small fixes that usually pop up over time.
Henrik Opel
+3  A: 

For editing? You don't need code at all, provided you use the CCK module on your site.

Go to Admin > Content Types. Click on "manage fields" on the content type you want to edit, then drag the Taxonomy module form underneath the body. Hit Save, you're done.

For maximum control, you can also use the Content Taxonomy module which turns taxonomies into CCK fields.

bmann
The "manage fields" option does not exist for me. Is that a setting in the site preferences?
Lloyd
@Lloyd: You would only have this option if you used the CCK module on your site.
Henrik Opel
@bmann: I added the CCK module dependency to your answer - hope that's ok. (+1 for pointing out this non-code alternative - most sites use CCK and this is certainly easier than the `hook_form_alter()` method)
Henrik Opel
@Opel @bmann, you are right. I installed CCK last night for another reason and saw this option appeared. And yes, WAY easier. Not that whipping together a module was that hard, but almost always better to play with a standard solution than to roll your own.
Lloyd

related questions