What it does

The Term Sibling Reorder module allows taxonomy term administrators to reorder a term and it's siblings from the add or edit page for a term.

This is especially helpful if you're using taxonomy for something more than backend categorization. If you have a list of all terms in a block for navigation with Views, or if you're using Taxonomy Menu with the sync option (currently only in the 7.x-1.x-dev release), this module can let you add a term without temporarily affecting your site's output.

This was born out of the issue described above. We were using Taxonomy Menu and didn't want to be affecting our primary menu while we went and reordered it. It's also convenient to be able to do both operations from one place (similar to Drupal 7's ability to change block regions from the block edit page). Choosing a new parent will get a new list of siblings using Drupal 7's AJAX API.

Basically, when adding a new form, select it's position inside the Relations fieldset and then hit save. The term (and it's siblings, if their weights were changed), will reflect the new order.

Screenshot

Here's an image of the basic workflow.

Project page

The project page is here: http://drupal.org/sandbox/ryandekker/1566106

Get the code

git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/ryandekker/1566106.git term_sibling_reorder

Drupal version

This module is for Drupal 7.x only.

Reviews of other projects

Comments

ryandekker’s picture

Issue summary: View changes

Adding git clone command.

ryandekker’s picture

Issue tags: +PAreview: review bonus

Adding "PAReview: review bonus" tag after reviewing projects listed above.

ryandekker’s picture

Issue summary: View changes

Making information more readable with bullets, adding "Reviews of other projects" section.

thyssimonis’s picture

You need add dependencie "Taxonomy" in your info file.
In admin/modules you can disable Taxonomy.

dependencies[] = taxonomy

ryandekker’s picture

Ah, good call. Thanks, I've updated the module to include taxonomy as a dependency.

klausi’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

manual review:

  1. "'#type' => 'hidden',": If a form has a submit function, then hidden form values are not needed. Instead, any values that you need to pass to $form_state['values'] can be declared in the $form array as '#type' => 'value'.
  2. "if (strpos($key, '#') !== FALSE)": better use element_children() to filter out the "#" keys?
  3. term_sibling_reorder_taxonomy_form_term_post_submit(): directly calling db_update() is not a good idea as other modules cannot react on the update of the term. Better load and taxonomy_term_save() the term so that the taxonomy hooks are fired, e.g. hook_taxonomy_term_update().

But otherwise looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

ryandekker’s picture

Thanks for the feedback klausi!

I implemented those changes:

  1. I changed this from "hidden" to "value". However, core (what I used for reference) seems to prefer "hidden" for draggable tables (i.e. taxonomy_overview_terms()). I guess it works either way and value is a bit cleaner, so I see where you're coming from.
  2. Good point. Here's the new look:
      foreach (element_children($form) as $key) {
        $term = $form[$key];
    
  3. Yikes. You're absolutely right here... I hate it when other modules do this. :) New code:
      $term = taxonomy_term_load($tid);
      $term->weight = $weight;
      taxonomy_term_save($term);
    

Do I need to do anything else here to get full project access?

patrickd’s picture

Status: Reviewed & tested by the community » Fixed

Your project page looks quite short, you may have a look at the tips for a great project page.

package = Other not necessary, it'll be in others automatically if you leave this out

Anyway, works out for me, nicely done

Thanks for your contribution and welcome to the community of project contributors on drupal.org!

I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.

Thanks to the dedicated reviewer(s) as well.

ryandekker’s picture

Thanks patrickd! I'll work on the project page.

Thanks klausi and thyssimonis for your reviews as well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updating link to my comment in Username Prefixes.