Only Show Certain Themes

I was looking for a way to only show certain themes on admin/build/themes page. I ended up adding some jquery to handle this. I created this script in a js file called theme_list.js.

var themes =new Array();

//Enter themes here into the array.
themes[0] = 'theme_1';
themes[1] = 'theme_2';
themes[2] = 'theme_3';

if(Drupal.jsEnabled) {
  $(document).ready(
    function(){
      //Hide all the themes.
      $('form#system-themes-form table.sticky-table tbody tr').toggle();

      //Only show the themes we want to appear.
      for (var i in themes){
        $("input[@value='" + themes [i] + "']").parent().parent().parent().parent().toggle();
      }
    }
  );
}

Then go into your template.php file and add this.

<?php
$theme_path = drupal_get_path('theme', 'your_admin_theme');
drupal_add_js($theme_path .'/js/theme_list.js', 'theme');
?>

A little hacky but should work.

Explore posts in the same categories: Drupal, PHP, Templates, javascript

Tags:

You can comment below, or link to this permanent URL from your own site.

Comment: