How to Extend Drupal’s default Taxonomy terms overview table listing

You can add a new column to the default Drupal’s Taxonomy term listing page that provides a link to a DraggableViews (receives term ID from contextual filter) for sorting nodes.

This Post will show you briefly on how to make use of hook_theme().

See screenshot below for the final result.

 

 

 

blog-drupal-extend-taxonomy-overview-terms

 

 

/**
* Implements hook_form_FORM_ID_alter().
*/
function YOUR_MODULE_form_taxonomy_overview_terms_alter(&$form, &$form_state, $form_id) {
  // Add custom theme wrapper.
  array_unshift($form['#theme'], 'YOUR_MODULE_taxonomy_overview_terms');
}
/**
* Implements hook_theme().
*/
function YOUR_MODULE_theme() {
  return array(
    'YOUR_MODULE_taxonomy_overview_terms' => array(
      'render element' => 'form',
    ),
  );
}
function theme_YOUR_MODULE_taxonomy_overview_terms($vars) {
  ...
  // Codes from theme_taxonomy_overview_terms()

  foreach (element_children($form) as $key) {
    if (isset($form[$key]['#term'])) {
      $term = &$form[$key];
      $row = array();
      $row[] = (isset($term['#term']['depth']) && $term['#term']['depth'] > 0 ? theme('indentation', array('size' => $term['#term']['depth'])) : '') . drupal_render($term['view']);
      if ($form['#parent_fields']) {
        $term['tid']['#attributes']['class'] = array('term-id');
        $term['parent']['#attributes']['class'] = array('term-parent');
        $term['depth']['#attributes']['class'] = array('term-depth');
        $row[0] .= drupal_render($term['parent']) . drupal_render($term['tid']) . drupal_render($term['depth']);
      }
      $term['weight']['#attributes']['class'] = array('term-weight');
      $row[] = drupal_render($term['weight']);
      $row[] = drupal_render($term['edit']);
      $row[] = (isset($term['#term']['tid'])) ? l(t('sort'), 'blablabla/' . $term['#term']['tid']) : '';
      $row = array('data' => $row);
      $rows[$key] = $row;
    }
  }
  ...
}

 

 

23 thoughts on “How to Extend Drupal’s default Taxonomy terms overview table listing

  1. Spot on with this write-up, I actually believe this amazing site
    needs much more attention. I’ll probably be back again to read through more, thanks
    for the info!

  2. After looking at a number of the articles on your web site, I seriously like your technique of writing a
    blog. I book marked it to my bookmark site list and will be checking back
    soon.

  3. I am regular visitor, how are you everybody? This piece of
    writing posted at this web site is genuinely nice.

  4. Howdy! Do you know if they make any plugins to protect
    against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations?

  5. Hello I am so excited I found your web site, I really found you by mistake, while
    I was looking on Dig for something else, Anyhow I am here now and would just like to say kudos for a
    marvelous post and a all round thrilling blog (I also love the theme/design), I don’t have
    time to look over it all at the moment but I have bookmarked it and also added in your RSS feeds, so when I have time I will
    be back to read a great deal more, Please do keep up the fantastic job.

  6. This design is spectacular.Excellent job. I really loved what you had to say,
    and more than that, how you presented it. Too cool….

  7. If you would like to obtain a great deal from this post
    then you have to apply such strategies to your won weblog.

  8. Hi there, just became aware of your blog through Google,
    and found that it is truly informative. I’m going to watch out
    for brussels. I will appreciate if you continue this in future.
    Many people will be benefited from your writing.

    Cheers!

  9. Nice post. I used to be checking constantly this weblog and I am
    impressed! Very useful information particularly
    the closing section 🙂 I deal with such info much.
    I used to be seeking this particular information for a very
    long time. Thanks and good luck.

  10. With having so much content and articles do
    you ever run into any problems of plagiarism or copyright infringement?
    My site has a lot of exclusive content I’ve either authored myself or outsourced but it looks like a lot of it is popping it up all over the web without my authorization. Do you know any methods
    to help prevent content from being ripped off? I’d truly appreciate it.

  11. My partner and I stumbled over here coming from a different website and thought I
    may as well check things out. I like what I see so now i am
    following you. Look forward to checking out your web page for a second time.

  12. Thanks for your marvelous posting! I truly enjoyed reading it, you are a great author.

    I will remember to bookmark your blog and definitely will come back
    someday. I want to encourage you to ultimately continue your great
    work, have a nice morning!

  13. These are actually wonderful ideas in concerning blogging. You have touched some fastidious things here.
    Any way keep up writing.

  14. What’s up everyone, it’s my first pay a quick visit at this website, and article
    is in fact fruitful in favor of me, keep up posting such content.

  15. I do not even know the way I finished up right here, but I assumed this publish was great.
    I don’t recognize who you’re but definitely you are going to a well-known blogger should
    you aren’t already. Cheers!

  16. You ought to take part in a contest for one of
    the highest quality blogs on the web. I will recommend this website!

  17. Your way of explaining the whole thing in this paragraph
    is really good, all be capable of easily be aware of it, Thanks a lot.

  18. always i used to read smaller articles that as well clear their motive,
    and that is also happening with this article which I am reading at this
    place.

  19. Great post. I was checking constantly this blog and I am inspired!
    Very useful info specially the last part 🙂 I handle such info much.
    I was seeking this certain information for a long time.
    Thanks and best of luck.

  20. I have been browsing online greater than 4 hours today, yet I never found any interesting article
    like yours. It’s pretty worth enough for me personally. I think,
    if all site owners and bloggers made good content when you
    did, the net will probably be a lot more useful than before.

Leave a Reply

Your email address will not be published.