Browse Source

Removed older tripal_panes module

Stephen Ficklin 8 years ago
parent
commit
e7f3a3df31

+ 0 - 114
tripal_panes/theme/css/tripal_panes.css

@@ -1,114 +0,0 @@
-@CHARSET "UTF-8";
-
-.tripal-entity-pane {
-  border: solid 1px #CCC;
-  margin: 15px 0px;
-  padding: 15px;
-}
-
-.tripal-entity-pane h2 {
-  margin-top: 0px;
-}
-
-.tripal_panes-pane_configure-fieldset .form-type-radio {
-  display: inline;
-  margin-right: 15px !important;
-}
-
-.tripal_pane-configure_pane_table td {
-  width:25%;
-}
-
-/**
- * The Tripal generic pane template (tripal_panes_generic.tpl.php)
- * has an outer div box with class 'tripal-panes' and with an inner
- * table with an id of 'tripal-panes-table'.  The table has a single
- * row with two columns.  The smaller left column houses the table of
- * contents (TOC) for the node data.  The larger right column houses the data:
- *
- * |-----------------------------------------------|
- * |  .tripal-panes                                |
- * | |-------------------------------------------| |
- * | | .tripal-panes-table                       | |
- * | |        |                                  | |
- * | |        |                                  | |
- * | | TOC    |          Data                    | |
- * | | column |          Column                  | |
- * | |        |                                  | |
- * | |        |                                  | |
- * | |        |                                  | |
- * | |-------------------------------------------| |
- * |-----------------------------------------------|
- *
- * The tripal-panes box and the inner table are designed to fill the width
- * of the contents section of any theme.  Customize the CSS below to change
- * the look-and-feel.
- *
- */
-
-.tripal-panes {
-  width: 100%;
-}
-
-.tripal-panes-links {
-}
-
-.tripal-panes_table {
-  padding: 0px !important;
-  margin:  0px !important;
-}
-
-/**
- * The table formatting must override the default theme.  This is because
- * the table is meant for organizing the sidebar and contents so they don't
- * slip and slide around as would happen with div boxes that were floated.
- * Therefore, we use !important to keep the default theme from overrideing
- * the table settings.
- */
-
-.tripal-panes-table tbody {
-  padding: 0px !important;
-  margin:  0px !important;
-  border:  none !important;
-  background-color: transparent !important;
-}
-.tripal-panes-table-tr {
-  padding: 0px !important;
-  margin:  0px !important;
-  border:  none !important;
-  background-color: transparent !important;
-}
-.tripal-panes-table-td-toc {
-  border-right: 1px solid #CCCCCC !important;
-  margin:  0px !important;
-  padding: 0px !important;
-  background-color: transparent !important;
-  text-align: left !important;
-  vertical-align: top !important;
-}
-.tripal-panes-table-td-data {
-  border: none !important;
-  margin:  0px !important;
-  padding: 0px 0px 0px 20px !important;
-  background-color: transparent !important;
-  text-align: left !important;
-  vertical-align: top !important;
-}
-
-/**
- * The table of contents is an unordered list. The following can are used
- * to style the list
- */
-.tripal-panes-toc-list {
-
-}
-.tripal-panes-toc-list-item  {
-  padding: 3px 20px 3px 0px !important;
-  margin: 2px 0 2px 0 !important;
-}
-
-.tripal-panes-button {
-  height: 15px;
-  width: 15px;
-  vertical-align: text-top;
-}

BIN
tripal_panes/theme/images/close_btn.png


+ 0 - 45
tripal_panes/theme/js/tripal_panes.admin.js

@@ -1,45 +0,0 @@
-/**
- * Override the field UI's default behavior
- * @param $
- */
-(function($) {
-
-  Drupal.behaviors.tripalPane = {
-    attach: function (context, settings) {
-      Drupal.behaviors.fieldUIDisplayOverview = {};
-      rearrangeRegion ();
-    }
-  };
-  
-  function rearrangeRegion () {
-    // For each field, make sure the selected value matches the region where it resides
-    $('#field-display-overview tr.tabledrag-leaf').each(function () {
-      // ID
-      var id = $(this).attr('id');
-      // Get the region
-      var region = getRegion (this).attr('class');
-      var regex = /region-title region-(.+)-title/;
-      var match = regex.exec(region);
-      var region_id = match[1].replace('-', '_');
-      var select = $(this).find('div.form-item-fields-' + id + '-region select');
-      $(select).children().each(function() {
-        if ($(this).val() == region_id) {
-          $(this).attr('selected', 'true');
-        } else {
-          $(this).attr('selected', null);
-        }
-      });
-    });
-  }
-  
-  function getRegion (field) {
-    var previous = $(field).prev();
-    var region = null;
-    if ($(previous).hasClass('region-title')) {
-      region =  previous;
-    } else {
-      region = getRegion (previous);
-    }
-    return region;
-  }
-})(jQuery);

+ 0 - 70
tripal_panes/theme/js/tripal_panes.js

@@ -1,70 +0,0 @@
-(function($) {
-
-  Drupal.behaviors.tripal_panes = {
-    attach: function (context, settings){
-
-      // Add a close button for each pane except for the te_base
-      $('.tripal_pane-fieldset .fieldset-legend').each(function (i) {
-        if ($(this).parent().parent().attr('id') != 'tripal_pane-fieldset-te_base') {
-          $(this).append('<div class="tripal_pane-fieldset-close_button"><img src="' + panes_theme_dir + '/images/close_btn.png" id="tripal-panes-close-button" class="tripal-panes-button"></div>');
-        }
-      });
-
-      // Hide the pane when the close button is clicked
-      $('.tripal_pane-fieldset-close_button').each(function (i) {
-        $(this).css('float', 'right');
-        $(this).css('cursor', 'pointer');
-        $(this).css('margin', '0px 5px');
-        $(this).click(function () {
-          var fs = $(this).parent().parent().parent();
-          var fsid = fs.attr('id');
-          if (fsid.indexOf('tripal_pane-fieldset-') == 0) {
-            $(fs).fadeOut(300);
-          }
-        });
-      });
-
-      // Move the pane to the first when its TOC item is clicked.
-      $('.tripal_panes-toc-list-item-link').each(function (i) {
-        $(this).click(function() {
-          var id = '#tripal_pane-fieldset-' + $(this).attr('id');
-
-          var prevObj = $(id).prev().attr('class');
-            // If the user clicks on the te_base TOC item, open the fieldset if it's closed
-            if (id == '#tripal_pane-fieldset-te_base') {
-              if ($('#tripal_pane-fieldset-te_base').hasClass('collapsed')) {
-            	  $('#tripal_pane-fieldset-te_base').removeClass('collapsed');
-            	  $('#tripal_pane-fieldset-te_base .fieldset-wrapper').show();
-              }
-              else {
-                 $('#tripal_pane-fieldset-te_base').fadeTo(10, 0.3, function() {});
-                 $('#tripal_pane-fieldset-te_base').fadeTo(200, 1, function() {});
-              }
-            }
-            // If the user clicks on other TOC item, move its fieldset to the top right below the te_base
-            else {
-              $(id).removeClass('collapsed');
-              $(id + ' .fieldset-wrapper').show();
-              // Hightlight the fieldset instead of moving if it's already at the top
-              if (prevObj.indexOf('tripal-panes-content-top') == 0 && $(id).css('display') == 'block' && $('#tripal_pane-fieldset-te_base').hasClass('collapsed')) {
-                $(id).fadeTo(10, 0.3, function() {});
-                $(id).fadeTo(200, 1, function() {});
-              }
-              else {
-                $(id).hide();
-                var obj = $(id).detach();
-                $('.tripal-panes-content-top').after(obj);
-              }
-              // Close the te_base fieldset
-              $('#tripal_pane-fieldset-te_base .fieldset-wrapper').hide();
-              $('#tripal_pane-fieldset-te_base').addClass('collapsed');
-            }
-            $(id).show(300);
-          //}
-          return false;
-        });
-      });
-    },
-  };
-  
-})(jQuery);

+ 0 - 214
tripal_panes/theme/templates/tripal_panes_generic.tpl.php

@@ -1,214 +0,0 @@
-<?php
-/**
- * This template file provides the layout for the Tripal Panes modules.  It
- * allows fields to be displayed inside of collapsible panes.
- *
- */
-
-// Add some necessary JavaScript dependencies.
-drupal_add_js('misc/form.js');
-drupal_add_js('misc/collapse.js');
-drupal_add_js(drupal_get_path('module','tripal_panes') . '/theme/js/tripal_panes.js');
-
-// Get the variables passed into this template.
-$bundle = $variables['element']['#bundle'];
-$bundle_type = $bundle->name . '-' . $bundle->label;
-
-$content = '';
-$toc = '';
-$panes = $variables['element']['#panes'];
-$fields = $variables['element']['#fields'];
-$has_base_pane_only = count($panes) == 1 ? TRUE : FALSE;
-
-get_content($panes, $fields, $bundle_type, $content, $toc, $has_base_pane_only);
-
-if ($has_base_pane_only) { ?>
-  <div id ="tripal-<?php print $bundle_type?>-contents-box"> <?php
-    // print the rendered content
-    print $content; ?>
-  </div> <?php
-}
-else { ?>
-  <table id ="tripal-<?php print $bundle_type?>-contents-table" class="tripal-panes-table">
-    <tr class="tripal-panes-table-tr">
-      <td nowrap class="tripal-panes-table-td tripal-panes-table-td-toc" align="left"><?php
-        print $toc; ?>
-      </td>
-      <td class="tripal-panes-table-td-data" align="left" width="100%"><?php
-        // print the rendered content
-        print $content; ?>
-      </td>
-    </tr>
-  </table> <?php
-}
-
-/**
- * Iterates through the panes and generates the HTML conent
- *
- * @param $variables
- * @param $bundle_type
- * @param $content
- * @param $toc
- * @param $has_base_pane_only
- */
-function get_content($panes, $fields, $bundle_type, &$content, &$toc, $has_base_pane_only) {
-
-
-  // Iterate through all of the panes.
-  foreach ($panes AS $pane_id => $pane) {
-    // If we have a pane other than the base pane then we have more than
-    // just the base.
-
-    $pane_settings = unserialize($pane->settings);
-    $table_layout_group = key_exists('table_layout', $pane_settings) ? $pane_settings['table_layout'] : array();
-
-    // Rearrange fields into groups for each pane
-    $pane_fields = $fields[$pane_id];
-
-    // Order the fields by their assigned weights.
-    $ordered_fields = array();
-    foreach ($pane_fields as $field) {
-      $ordered_fields[$field['#weight'] . $field['#field_name']] = $field;
-    }
-    ksort($ordered_fields, SORT_NUMERIC);
-
-    // Render fields
-    $table_layout = array();
-    $no_group = array();
-    $output = '';
-    $current_layout = '';
-    $counter = 0;
-    foreach ($ordered_fields AS $field) {
-      //Add CSS Class
-      $css_class = $field['#css_class'] ? ' ' . $field['#css_class'] : '';
-      $field['#prefix'] = '<div class="tripal_panes-field-wrapper' . $css_class . '">';
-      $field['#suffix'] = '</div>';
-
-      // The field is in a table
-      if (in_array($field['#field_name'], $table_layout_group)) {
-
-        if ($counter != 0 && $current_layout != 'Table') {
-          $output .= tripal_panes_generic_render_fields($no_group);
-          $no_group = array();
-        }
-        $table_layout [$field['#weight'] . $field['#field_name']] = $field;
-        $current_layout = 'Table';
-      }
-      // The field is not in a table
-      else {
-        if ($counter != 0 && $current_layout != 'Default') {
-          $output .= tripal_panes_generic_render_table($table_layout, $bundle_type);
-          $table_layout = array();
-        }
-        $no_group [$field['#weight'] . $field['#field_name']] = $field;
-        $current_layout = 'Default';
-      }
-      $counter ++;
-    }
-    if ($current_layout == 'Table') {
-      $output .= tripal_panes_generic_render_table($table_layout, $bundle_type);
-    }
-    else if ($current_layout == 'Default') {
-      $output .= tripal_panes_generic_render_fields($no_group);
-    }
-
-    if ($has_base_pane_only) {
-      $content .= $output;
-    }
-    else {
-      $pane_label = $pane->name == 'te_base' ? 'Summary' : $pane->label;
-      $collapsible_item = array('element' => array());
-      $collapsible_item['element']['#description'] = $output;
-      $collapsible_item['element']['#title'] = $pane_label;
-      $collapsible_item['element']['#children'] = '';
-      $collapsible_item['element']['#attributes']['id'] = 'tripal_pane-fieldset-' . $pane->name;
-      $collapsible_item['element']['#attributes']['class'][] = 'tripal_pane-fieldset';
-      $collapsible_item['element']['#attributes']['class'][] = 'collapsible';
-      if ($pane->name != 'te_base') {
-        $collapsible_item['element']['#attributes']['class'][] = 'collapsed';
-      }
-      $toc_item_id = $pane_id;
-      $toc .= "<div class=\"tripal-panes-toc-list-item\"><a id=\"" . $pane->name . "\" class=\"tripal_panes-toc-list-item-link\" href=\"?pane=" . $pane->name . "\">" . $pane_label . "</a></div>";
-      $content .= theme('fieldset', $collapsible_item);
-    }
-    if ($pane->name == 'te_base') {
-      $content .= '<div class="tripal-panes-content-top"></div>';
-    }
-  }
-}
-
-
-/**
- * A wrapper function for placing fields inside of a Drupal themed table.
- *
- * @param $fields
- *   The list of fields present in the pane.
- * @return
- *   A string containing the HTMLified table.
- */
-function tripal_panes_generic_render_table($fields, $bundle_type) {
-  // If we have no fields in table layout
-  if (count($fields) == 0) {
-    return '';
-  }
-
-  // Create the rows for the table.
-  $header = array();
-  $rows = array();
-  foreach ($fields as $field) {
-    // We may have multiple values for the field, so we need to iterate
-    // through those values first and add each one.
-    $value = '';
-    foreach (element_children($field) as $index) {
-      $eo = 'odd';
-      if ($index % 2 == 0) {
-        $eo = 'even';
-      }
-      $value .= "<div class=\"field-item $eo\">" . $field[$index]['#markup'] . '</div>';
-    }
-
-    // Add the new row.
-    $rows[] = array(
-      array(
-        'data' => '<div class="field-label">' . $field['#title'] . '</div>',
-        'header' => TRUE,
-        'width' => '20%',
-        'nowrap' => 'nowrap'
-      ),
-      $value,
-    );
-  }
-
-  // Theme the table.
-  return theme_table(array(
-    'header' => $header,
-    'rows' => $rows,
-    'attributes' => array(
-      'id' => 'tripal_panes-' . $bundle_type . '-table',  // TODO: need to add an ID
-      'class' => 'tripal-data-horz-table'
-    ),
-    'sticky' => FALSE,
-    'caption' => '',
-    'colgroups' => array(),
-    'empty' => '',
-  ));
-}
-
-/**
- * A wrapper function for default rending of fields.
- *
- * @param $fields
- *   An array of fields to be rendered
- * @return
- *   A string containing the HTML of the rendered fields.
- */
-function tripal_panes_generic_render_fields($fields) {
-  if (count($fields) == 0) {
-    return '';
-  }
-  $content = '';
-  foreach ($fields as $field) {
-    $content .= render($field);
-  }
-  return $content;
-}

+ 0 - 8
tripal_panes/tripal_panes.info

@@ -1,8 +0,0 @@
-name = Tripal Panes
-description = Provides display options for Tripal Entities.  It includes a template that includes a sidebar with links to removable panes.
-core = 7.x
-project = tripal
-package = Tripal
-version = 7.x-3.0-alpha1
-
-dependencies[] = tripal

+ 0 - 188
tripal_panes/tripal_panes.install

@@ -1,188 +0,0 @@
-<?php
-
-/**
- * Implements hook_schema().
- */
-function tripal_panes_schema() {
-  $schema = array();
-
-  $schema['tripal_panes'] = array(
-    'description' => 'The list of panes into which fields can be placed.',
-    'fields' => array(
-      'pane_id' => array(
-        'description' => 'The primary identifier for this table.',
-        'type' => 'serial',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'bundle_id' => array(
-        'description' => 'A bundle ID from the tripal_bundle table.',
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'name' => array(
-        'description' => 'The computer readable name for the pane. This name must only have alphanumerical characters and underscores and must not begin with a number. ',
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'label' => array(
-        'description' => 'A human readable name for pane. This name will be shown to users in the sidebar menu.',
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'settings' => array(
-        'description' => 'Contains a serialized array tripal_panesof settings for the pane.',
-        'type' => 'text',
-        'not null' => FALSE,
-      ),
-      'weight' => array(
-        'type' => 'int',
-        'not null' => FALSE,
-        'default' => 0
-      ),
-    ),
-    'indexes' => array(
-      'bundle_id' => array('bundle_id'),
-    ),
-    'unique keys' => array(
-      'bundle_pane' => array('bundle_id', 'name'),
-    ),
-    'foreign keys' => array(
-      'tripal_bundle' => array(
-        'table' => 'tripal_bundle',
-        'columns' => array(
-          'bundle_id' => 'id',
-        ),
-      ),
-    ),
-    'primary key' => array('pane_id'),
-  );
-  $schema['tripal_pane_fields'] = array(
-    'description' => 'The list of panes into which fields can be placed.',
-    'fields' => array(
-      'pane_field_id' => array(
-        'description' => 'The primary identifier for this table.',
-        'type' => 'serial',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'pane_id' => array(
-        'description' => 'The primary identifier for this table.',
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'field_id' => array(
-        'description' => 'A bundle ID from the tripal_bundle table.',
-        'type' => 'int',
-        'not null' => TRUE,
-      ),
-      'css_class' => array(
-        'description' => 'CSS classes assigned to this field. Class names are separated by a semi-colon',
-        'type' => 'text'
-      )
-    ),
-    'indexes' => array(
-      'pane_id' => array('pane_id'),
-      'field_id' => array('field_id'),
-    ),
-    'unique keys' => array(
-      'pane_field' => array('pane_id', 'field_id'),
-    ),
-    'foreign keys' => array(
-      'tripal_pane' => array(
-        'table' => 'tripal_pane',
-        'columns' => array(
-          'pane_id' => 'pane_id',
-        ),
-      ),
-      'field_config' => array(
-        'table' => 'field_config',
-        'columns' => array(
-          'field_id' => 'id',
-        ),
-      ),
-    ),
-    'primary key' => array('pane_field_id'),
-  );
-
-  return $schema;
-}
-
-/**
- *
- */
-function tripal_add_tripal_bundle_panes_table(){
-  $schema = array (
-    'table' => 'tripal_bundle_panes',
-    'fields' => array (
-      'pane_id' => array (
-        'type' => 'serial',
-        'not null' => TRUE
-      ),
-      'bundle_id' => array(
-        'type' => 'int',
-        'not null' => TRUE
-      ),
-      'name' => array (
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => TRUE
-      ),
-      'weight' => array (
-        'type' => 'int',
-        'not null' => TRUE
-      ),
-      'settings' => array(
-        'type' => 'text'
-      ),
-    ),
-    'primary key' => array (
-      0 => 'pane_id'
-    ),
-    'foreign keys' => array (
-      'tripal_bundle' => array (
-        'table' => 'tripal_bundle',
-        'columns' => array (
-          'bundle_id' => 'bundle_id'
-        ),
-      ),
-    ),
-    'unique keys' => array (
-      'tripal_bundle_panes_name' => array ('name'),
-    ),
-    'indexes' => array(
-      'tripal_bundle_panes_bundle_id' => array('bundle_id'),
-    ),
-  );
-  chado_create_custom_table('tripal_bundle_panes', $schema, TRUE);
-}
-
-function tripal_panes_update_7203() {
-  module_load_include('module', 'tripal_ws', 'tripal_ws');
-
-  tripal_ws_test();
-}
-
-
-/**
- * Implementation of hook_update_dependencies().
- *
- * It specifies a list of other modules whose updates must be run prior to
- * this one.  It also ensures the the Tripal API is in scope for site
- * upgrades when tripal is disabled.
- */
-function tripal_panes_update_dependencies() {
-  // Make sure we have the full API loaded this will help during a
-  // site upgrade when the tripal_core module is disabled.
-  //module_load_include('module', 'tripal', 'tripal');
-  //tripal_import_api();
-  module_load_include('module', 'tripal_ws', 'tripal_ws');
-
-  $dependencies = array();
-
-  return $dependencies;
-}

+ 0 - 937
tripal_panes/tripal_panes.module

@@ -1,937 +0,0 @@
-<?php
-
-
-/**
- * Implements hook_form_init();
- */
-function tripal_panes_init() {
-  $theme_dir = url(drupal_get_path('module', 'tripal_panes') . '/theme');
-  drupal_add_js("var panes_theme_dir  = '$theme_dir';", 'inline', 'header');
-}
-
-/**
- * Implements hook_form_FORM_ID_alter().
- *
- * The field_ui_display_overview_form is used for formatting the display
- * or layout of fields attached to an entity.
- */
-function tripal_panes_form_field_ui_display_overview_form_alter(&$form, &$form_state, $form_id) {
-  // Only modify the form for Tripal Content Type
-  if ($form['#entity_type'] != 'TripalEntity') {
-    return;
-  }
-  drupal_add_js(drupal_get_path('module','tripal_panes') . '/theme/js/tripal_panes.admin.js');
-  drupal_add_css(drupal_get_path('module','tripal_panes') . '/theme/css/tripal_panes.css');
-
-  $entity_type = $form['#entity_type'];
-  $bundle_name = $form['#bundle'];
-
-  // Get the bundle record.
-  $bundle = db_select('tripal_bundle', 'tb')
-    ->fields('tb')
-    ->condition('name', $bundle_name)
-    ->execute()
-    ->fetchObject();
-
-  if (module_exists('ds')) {
-    drupal_set_message('Tripal is not compatible with the Display Suite (ds)
-        module. If you would like to use Tripal-style panes for the layout
-        of your pages please disable the Display Suite module. If you
-        prefer to use the Display Suite module then disable the Tripal
-        Panes (tripal_panes) module.', 'warning');
-  }
-
-  // Add a vertical tab fieldset at the bottom of the
-  $form['overview_vert_tabs'] = array(
-    '#type' => 'vertical_tabs'
-  );
-  $form['modes']['#group'] = 'overview_vert_tabs';
-  $form['modes']['#weight'] = 1000;
-  $form['te_add_panes'] = array(
-    '#type' => 'fieldset',
-    '#title' => 'Add a Pane',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#group' => 'overview_vert_tabs'
-  );
-
-  // Make sure our default pane are in the database.
-  tripal_panes_check_default_field_panes($bundle);
-
-  // Adds form elments as a vertical tab for adding a pane.
-  tripal_panes_form_field_ui_display_overview_form_pane_add($form, $form_state);
-
-  // Adds form elments as a vertical tab for arranging panes.
-  tripal_panes_form_field_ui_display_overview_form_pane_arrange($form, $form_state, $bundle);
-
-  // Adds form elments as a vertical tab for configuring panes.
-  tripal_panes_form_field_ui_display_overview_form_pane_configure($form, $form_state, $bundle);
-
-  // Now add each pane as a region.
-  $form['fields']['#regions'] = array();
-  $panes = db_select('tripal_panes', 'tp')
-    ->fields('tp')
-    ->condition('bundle_id', $bundle->id)
-    ->orderBy('weight', 'ASC')
-    ->orderBy('label', 'ASC')
-    ->execute();
-  $pane_options = array();
-
-  while ($pane = $panes->fetchObject()) {
-    $settings = unserialize($pane->settings);
-    $form['fields']['#regions'][$pane->name] = array(
-      'title' => t($pane->label),
-      'message' => t($settings['message']),
-    );
-    $pane_options[$pane->name] = $pane->label;
-  }
-
-  // Set the table headers to add a new 'region' column.
-  $form['fields']['#header'] = array(
-    t('Field'),
-    t('Weight'),
-    t('Parent'),
-    t('Label'),
-    array('data' => t('Format'), 'colspan' => 3),
-    t('Region')
-  );
-
-  // Change the region callback for each field to place each field in the
-  // proper "pane" region. Also, set the default region to be the base region.
-  $fields = $form['fields'];
-  $default_pane = 'te_base';
-
-  foreach (element_children($fields) as $field_name) {
-    $field_instance = field_info_instance($entity_type, $field_name, $bundle_name);
-    $pane_id = db_select('tripal_pane_fields', 'tpf')
-      ->fields('tpf', array('pane_id'))
-      ->condition('field_id', $field_instance['id'])
-      ->execute()
-      ->fetchField();
-    if ($pane_id) {
-      $default_pane = db_select('tripal_panes', 'tp')
-      ->fields('tp', array('name'))
-      ->condition('pane_id', $pane_id)
-      ->execute()
-      ->fetchField();
-    }
-    $form['fields'][$field_name]['#region_callback'] = 'tripal_panes_field_ui_row_region';
-    $form['fields'][$field_name]['region'] = array(
-      '#type' => 'select',
-      '#options' => $pane_options,
-      '#default_value' => $default_pane,
-      '#attributes' => array(
-        'class' => array('te-field-region'),
-      )
-    );
-    $form['fields'][$field_name]['#field_instance_id'] = array(
-      '#type' => 'value',
-      '#value' => $field_instance['id']
-    );
-  }
-
-  // Add validate and submit handlers. Rearrange the submit callbacks
-  // so ours is first.
-  $form['#validate'][] = 'tripal_panes_field_ui_validate';
-  $submit = $form['#submit'];
-  $form['#submit'] = array('tripal_panes_field_ui_submit');
-  $form['#submit'] = array_merge($form['#submit'], $submit);
-}
-
-/**
- * Add a pane Form
- */
-function tripal_panes_form_field_ui_display_overview_form_pane_add (&$form, &$form_state) {
-  $form_state['input']['pane_label'] = key_exists('pane_label', $form_state['input']) ? $form_state['values']['pane_label'] : NULL;
-  $form['te_add_panes']['instructions'] = array(
-    '#type' => 'item',
-    '#markup' => t('You may add as many panes to your page layout as
-        desired. panes can be used to organize fields into categories.')
-  );
-  $form['te_add_panes']['pane_name'] = array(
-    '#type' => 'hidden',
-    '#title' => 'pane Name',
-    '#description' => t('The name is automatically generated for a label. it
-        contains alphanumeric values and underscores and does not begin with
-        a number.')
-  );
-  $form['te_add_panes']['pane_label'] = array(
-    '#type' => 'textfield',
-    '#title' => 'Pane Label',
-    '#default_value' => '',
-    '#description' => t('Please provide a human readable label for this
-        pane. This is the name that will appear to site visitors.')
-  );
-  $form['te_add_panes']['add_button'] = array(
-    '#type' => 'submit',
-    '#value' => 'Add pane',
-    '#name' => 'add-pane-submit'
-  );
-}
-
-/**
- * Arrange panes Form
- */
-function tripal_panes_form_field_ui_display_overview_form_pane_arrange (&$form, &$form_state, $bundle) {
-  $form['te_arrange_panes'] = array(
-    '#type' => 'fieldset',
-    '#title' => 'Arrange Panes',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#group' => 'overview_vert_tabs'
-  );
-  $form['te_arrange_panes']['instructions'] = array(
-    '#type' => 'item',
-    '#markup' => t('Drag and drop the pane to change its order.')
-  );
-  $form['te_arrange_panes']['pane_items']['#tree'] = TRUE;
-  // Get available panes
-  $result = db_select('tripal_panes', 'tp')
-  ->fields('tp', array('pane_id', 'name', 'label', 'weight'))
-  ->condition('name', 'te_base', '<>')
-  ->condition('name', 'te_disabled', '<>')
-  ->condition('bundle_id', $bundle->id)
-  ->orderby('weight', 'asc')
-  ->execute();
-  $has_pane = FALSE;
-  foreach ($result as $item) {
-    $form_state['input']['pane_items'][$item->pane_id]['newlabel'] = key_exists($item->pane_id, $form_state['input']) && $form_state['input'][$item->pane_id]['newlabel'] ? $form_state['values']['pane_items'][$item->pane_id]['newlabel'] : NULL;
-    $form['te_arrange_panes']['pane_items'][$item->pane_id] = array(
-      'label' => array(
-        '#markup' => check_plain($item->label),
-      ),
-      'weight' => array(
-        '#type' => 'weight',
-        '#title' => t('Weight'),
-        '#default_value' => $item->weight,
-        '#delta' => 50,
-        '#title_display' => 'invisible',
-      ),
-      'newlabel' => array(
-        '#type' => 'textfield',
-        '#default_value' => '',
-        '#size' => 10
-      ),
-      'rename' => array(
-        '#type' => 'submit',
-        '#value' => 'Rename',
-        '#name' => "arrange-pane-rename-$item->pane_id",
-      ),
-      'remove' => array(
-        '#type' => 'submit',
-        '#value' => 'Remove',
-        '#name' => "arrange-pane-remove-$item->pane_id",
-      )
-    );
-    $has_pane = TRUE;
-  }
-  if ($has_pane) {
-    $form['te_arrange_panes']['pane_items']['#theme_wrappers'] = array('tripal_panes_form_arrange_panes');
-    $form['te_arrange_panes']['save_button'] = array(
-      '#type' => 'submit',
-      '#value' => 'Save pane Order',
-      '#name' => 'order-pane-submit'
-    );
-  }
-  else {
-    $form['te_arrange_panes']['instructions']['#markup'] = t('A pane must be added before any arrangements can be made.');
-  }
-}
-
-/**
- * Configure panes Form
- */
-function tripal_panes_form_field_ui_display_overview_form_pane_configure (&$form, &$form_state, $bundle) {
-  $form['te_configure_panes'] = array(
-    '#type' => 'fieldset',
-    '#title' => 'Configure Panes',
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-    '#group' => 'overview_vert_tabs'
-  );
-
-  // Add a dropdown for selecting pane to configure
-  $form['te_configure_panes']['pane_select'] = array(
-    '#type' => 'select',
-    '#title' => t('Pane Name'),
-    '#description' => t('Select a pane to change its layout. Fields can be grouped into a table if Table layout is selected.'),
-    '#ajax' => array(
-      'callback' => 'tripal_panes_ajax_get_pane_setting_fieldset',
-      'wrapper' => 'tripal-fields-layout-pane-setting',
-      'effect' => 'fade'
-    )
-  );
-
-  $form['te_configure_panes']['pane_items'] = array (
-    '#tree' => TRUE,
-    '#prefix' => '<div id="tripal-fields-layout-pane-setting">',
-    '#suffix' => '</div>'
-  );
-
-  // Get available panes
-  $panes = db_select('tripal_panes', 'tp')
-  ->fields('tp', array('pane_id', 'name', 'label', 'weight', 'settings'))
-  ->condition('name', 'te_disabled', '<>')
-  ->condition('bundle_id', $bundle->id)
-  ->orderby('weight', 'asc')
-  ->execute();
-
-  $has_pane = FALSE;
-  $options = array(0 => 'Select a Pane');
-  $selected_pane = key_exists('values', $form_state) ? $form_state['values']['pane_select'] : 0;
-  foreach ($panes as $pane) {
-    $options[$pane->pane_id] = $pane->label;
-    $has_pane = TRUE;
-    $pane_settings = unserialize($pane->settings);
-    $table_layout = key_exists('table_layout', $pane_settings) ? $pane_settings['table_layout'] : array();
-    $form['te_configure_panes']['pane_items'][$pane->pane_id] = array(
-      '#type' => 'fieldset',
-      '#title' => check_plain($pane->label),
-      '#collapsible' => TRUE,
-      '#collapsed' => FALSE,
-    );
-    //Add fields to each pane for changing configuration
-    $fields = db_select('tripal_pane_fields', 'tpf')
-    ->fields('tpf', array('field_id'))
-    ->condition('pane_id', $pane->pane_id)
-    ->execute();
-
-    $has_field = FALSE;
-    foreach ($fields AS $field) {
-      $field_obj = db_select('field_config_instance', 'tci')
-        ->fields('tci', array('field_name','data'))
-        ->condition('id', $field->field_id)
-        ->execute()
-        ->fetchObject();
-      // If the table gets out of sync (e.g. field are deleted manually)
-      // the the object may be empty.
-      if (!$field_obj) {
-        continue;
-      }
-      $field_arr = unserialize($field_obj->data);
-      $fname = $field_obj->field_name;
-      if($fname == 'featureprop' || $fname == 'projectprop' || $fname == 'analysisprop' || $fname == 'organismprop') {
-        $propkey = array_search($fname, $form['#fields']);
-        unset($form['#fields'][$propkey]);
-        continue;
-      }
-      $flable = $field_arr['label'];
-      $form['te_configure_panes']['pane_items'][$pane->pane_id][$fname] = array(
-        '#type' => 'item',
-        '#title' => $flable,
-        '#weight' => $field_arr['display']['default']['weight']
-      );
-      $default_value = 0;
-      if (in_array($fname, $table_layout)) {
-        $default_value = 1;
-      }
-      $form['te_configure_panes']['pane_items'][$pane->pane_id][$fname]['table_group'] = array(
-        '#type' => 'radios',
-        '#options' => array(
-          0 => 'Default',
-          1 => 'Table',
-        ),
-        '#default_value' => $default_value,
-      );
-      $form['te_configure_panes']['pane_items'][$pane->pane_id][$fname]['field_id'] = array(
-        '#type' => 'hidden',
-        '#value' => $field->field_id,
-      );
-      $default_classes =
-        db_select('tripal_pane_fields', 'tpf')
-          ->fields('tpf', array('css_class'))
-          ->condition('pane_id', $pane->pane_id)
-          ->condition('field_id', $field->field_id)
-          ->execute()
-          ->fetchField();
-      $form['te_configure_panes']['pane_items'][$pane->pane_id][$fname]['css_class'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $default_classes,
-        '#size' => 40
-      );
-      $has_field = TRUE;
-    }
-
-    if (!$has_field) {
-      $form['te_configure_panes']['pane_items'][$pane->pane_id]['no_field'] = array(
-        '#markup' => 'No field in this pane.',
-      );
-    } else {
-      $form['te_configure_panes']['pane_items'][$pane->pane_id]['#theme_wrappers'] = array('tripal_panes_form_configure_panes');
-    }
-
-    if ($pane->pane_id != $selected_pane) {
-      // Display only the selected pane setting. Hide the others
-      $form['te_configure_panes']['pane_items'][$pane->pane_id]['#prefix'] = "<div style=\"display:none;\">";
-      $form['te_configure_panes']['pane_items'][$pane->pane_id]['#suffix'] = "</div>";
-    }
-
-  }
-  $form['te_configure_panes']['pane_select']['#options'] = $options;
-  if ($has_pane) {
-    $form['te_configure_panes']['save_button'] = array(
-      '#type' => 'submit',
-      '#value' => 'Save pane Configuration',
-      '#name' => 'configure-pane-submit'
-    );
-  }
-  else {
-    $form['te_configure_panes']['instructions']['#markup'] = t('A pane must be added before any configuration changes can be made.');
-  }
-}
-
-/**
- * A helper function for checking if the default panes are in the database.
- */
-function tripal_panes_check_default_field_panes($bundle) {
-  // Make sure we have records for our default regions: te_base and te_hidden.
-  // First check if the base region is in the database. If not, add it.
-  $te_base = db_select('tripal_panes', 'tp')
-    ->fields('tp')
-    ->condition('name', 'te_base')
-    ->condition('bundle_id', $bundle->id)
-    ->execute()
-    ->fetchObject();
-  if (!$te_base) {
-    $settings = array(
-      'message' => 'Fields that should appear at the top of each page should be placed in the base pane. These fields are always present and help orient the user by at least indicating the necessary information to uniquely identiy the content.',
-    );
-    db_insert('tripal_panes')
-      ->fields(array(
-        'bundle_id' => $bundle->id,
-        'name' => 'te_base',
-        'label' => 'Base Content',
-        'settings' => serialize($settings),
-        'weight' => -9999999
-      ))
-      ->execute();
-  }
-  // Now add all fields to the default region if they are not assigned
-  $pane_id = db_select('tripal_panes', 'tp')
-    ->fields('tp', array('pane_id'))
-    ->condition('name', 'te_base')
-    ->condition('bundle_id', $bundle->id)
-    ->execute()
-    ->fetchField();
-  if(property_exists($bundle, 'type')) {
-    $fields = db_select('field_config_instance', 'fci')
-      ->fields('fci', array('id'))
-      ->condition('entity_type', $bundle->type)
-      ->condition('bundle', $bundle->name)
-      ->execute();
-    foreach($fields AS $field) {
-      $penal_field_id = db_select('tripal_pane_fields', 'tpf')
-      ->fields('tpf', array('pane_field_id'))
-      ->condition('field_id', $field->id)
-      ->execute()
-      ->fetchField();
-      if (!$penal_field_id) {
-        db_insert('tripal_pane_fields')
-        ->fields(array(
-          'pane_id' => $pane_id,
-          'field_id' => $field->id
-        ))
-        ->execute();
-      }
-    }
-  }
-  // Next check if the hidden region is in the database. If not, add it.
-  $te_base = db_select('tripal_panes', 'tp')
-    ->fields('tp')
-    ->condition('name', 'te_disabled')
-    ->condition('bundle_id', $bundle->id)
-    ->execute()
-    ->fetchObject();
-  if (!$te_base) {
-    $settings = array(
-      'message' => 'Place field here to hide them from display.',
-    );
-    db_insert('tripal_panes')
-      ->fields(array(
-        'bundle_id' => $bundle->id,
-        'name' => 'te_disabled',
-        'label' => 'Disabled',
-        'settings' => serialize($settings),
-        'weight' => 9999999
-      ))
-      ->execute();
-  }
-}
-
-/**
- * Returns the region to which a row on the Field UI page belongs.
- *
- * @param $row
- *   The current row that is being rendered in the Field UI page.
- */
-function tripal_panes_field_ui_row_region($row) {
-  $default_pane =  'te_base';
-  $pane = '';
-
-  $field_instance_id = $row['#field_instance_id']['#value'];
-
-  // Get pane_id
-  $pane_id = db_select('tripal_pane_fields', 'tpf')
-  ->fields('tpf', array('pane_id'))
-  ->condition('field_id', $field_instance_id)
-  ->execute()
-  ->fetchField();
-
-  // Get pane name
-  if ($pane_id) {
-    $pane = db_select('tripal_panes', 'tp')
-    ->fields('tp', array('name'))
-    ->condition('pane_id', $pane_id)
-    ->execute()
-    ->fetchField();
-  }
-
-  // First get the pane
-  if (!$pane) {
-    $pane = $default_pane;
-  }
-
-  return $pane;
-
-}
-/**
- * Validates the field UI form to ensure proper pane assignments.
- *
- * @param $form
- * @param $form_state
- */
-function tripal_panes_field_ui_validate(&$form, &$form_state) {
-
-}
-/**
- * Responds to a submit from the field UI form for saving pane assignments.
- *
- * @param $form
- * @param $form_state
- */
-function tripal_panes_field_ui_submit($form, &$form_state) {
-// Add a pane
-  if ($form_state ['clicked_button'] ['#name'] == 'add-pane-submit') {
-    tripal_panes_action_add_pane($form, $form_state);
-  }
-  // Order panes
-  else if ($form_state['clicked_button'] ['#name'] == 'order-pane-submit') {
-    tripal_panes_action_order_panes($form, $form_state);
-  }
-  // Rename a pane
-  else if (preg_match('/^arrange-pane-rename-/', $form_state ['clicked_button'] ['#name'])) {
-    tripal_panes_action_rename_pane ($form, $form_state);
-  }
-  // Remove a pane
-  else if (preg_match('/^arrange-pane-remove-/', $form_state ['clicked_button'] ['#name'])) {
-    tripal_panes_action_remove_pane ($form_state);
-  }
-  // Configure panes
-  else if ($form_state['clicked_button'] ['#name'] == 'configure-pane-submit') {
-    tripal_panes_action_configure_panes($form, $form_state);
-  }
-  // Save fields for each pane
-  else if ($form_state['clicked_button'] ['#name'] == 'op') {
-    $bundle = $form_state['build_info']['args'][1];
-    $fields = $form_state['values']['fields'];
-    foreach($fields AS $field_name => $field_data){
-
-      // Get field instance id
-      $field_instance_id = $form['fields'][$field_name]['#field_instance_id']['#value'];
-
-      // Get region pane_id
-      $region = $field_data['region'];
-      $pane_id = db_select('tripal_panes', 'tp')
-        ->fields('tp', array('pane_id'))
-        ->condition('name', $region)
-        ->condition('bundle_id', $bundle->id)
-        ->execute()
-        ->fetchField();
-
-      // Save
-      $penal_field_id = db_select('tripal_pane_fields', 'tpf')
-      ->fields('tpf', array('pane_field_id'))
-      ->condition('field_id', $field_instance_id)
-      ->execute()
-      ->fetchField();
-
-      if ($penal_field_id) {
-        db_update('tripal_pane_fields')
-        ->fields(array(
-          'pane_id' => $pane_id,
-        ))
-        ->condition('pane_field_id', $penal_field_id)
-        ->execute();
-      }
-      else {
-        db_insert('tripal_pane_fields')
-        ->fields(array(
-          'pane_id' => $pane_id,
-          'field_id' => $field_instance_id
-        ))
-        ->execute();
-      }
-    }
-  }
-}
-
-/**
- * Add a new pane
- */
-function tripal_panes_action_add_pane (&$form, &$form_state) {
-  // Check if a pane label is provided
-  $label = $form_state ['values'] ['pane_label'];
-  if (! $label) {
-    form_set_error('pane_label', t ("Please provide a label for the new pane."));
-  }
-  // Generate a valide pane name using the label.
-  // i.e. removing leading numbers and spaces
-  $name = strtolower(preg_replace ('/^\d|\s+/', '_', $label));
-  $bundle = $form_state['build_info']['args'][1];
-  $name_exists = db_select('tripal_panes', 'tp')
-  ->fields('tp', array('pane_id'))
-  ->condition('name', $name)
-  ->condition('bundle_id', $bundle->id)
-  ->execute()
-  ->fetchField();
-  if ($name_exists) {
-    form_set_error('pane_label', t('The name is used by another pane. Please use a different label.'));
-  }
-  else {
-    $form_state ['values'] ['pane_name'] = $name;
-    $bundle_id = $form_state['build_info']['args'][1]->id;
-    $name      = $form_state['values']['pane_name'];
-    $label     = $form_state['values']['pane_label'];
-    $settings = array(
-      'message' => 'Place field in this pane.',
-    );
-    db_insert('tripal_panes')
-    ->fields(array(
-      'bundle_id' => $bundle_id,
-      'name' => $name,
-      'label' => $label,
-      'settings' => serialize($settings),
-      'weight' => 0
-    ))
-    ->execute();
-    form_set_value($form['te_add_panes']['pane_label'], '', $form_state);
-  }
-}
-
-/**
- * Rename pane
- */
-function tripal_panes_action_rename_pane (&$form, &$form_state) {
-  $button = $form_state ['triggering_element'] ['#name'];
-  $pane_id = str_replace ('arrange-pane-rename-', '', $button);
-  $newlabel = $form_state['values']['pane_items'][$pane_id]['newlabel'];
-  if (!trim($newlabel)) {
-    form_set_error ('pane_label', t ("Please provide a label to rename a pane.") );
-  }
-  else {
-    db_update('tripal_panes')
-    ->fields(array(
-      'label' => $newlabel,
-      'name' => strtolower(preg_replace ('/^\d|\s+/', '_', $newlabel))
-    ))
-    ->condition('pane_id', $pane_id)
-    ->execute();
-    form_set_value($form['te_arrange_panes']['pane_items'][$pane_id]['newlabel'], '', $form_state);
-  }
-}
-
-
-/**
- * Remove pane
- */
-function tripal_panes_action_remove_pane (&$form_state) {
-  $button = $form_state ['triggering_element'] ['#name'];
-  $pane_id = str_replace ('arrange-pane-remove-', '', $button);
-  db_delete('tripal_panes')
-  ->condition ('pane_id', $pane_id)
-  ->execute();
-  db_delete('tripal_pane_fields')
-  ->condition ('pane_id', $pane_id)
-  ->execute();
-}
-
-/**
- * Order pane
- */
-function tripal_panes_action_order_panes (&$form, &$form_state) {
-  $panes = $form_state['values']['pane_items'];
-  foreach ($panes AS $id => $pane) {
-    if (key_exists('weight', $pane)) {
-      db_query('UPDATE {tripal_panes} SET weight = :weight WHERE pane_id = :id',
-        array(
-          ':weight' => $pane['weight'],
-          ':id' => $id
-        )
-      );
-    }
-  }
-}
-
-/**
- *  Theme the Arrange panes as a draggable table
- *
- * @param $variables
- * @return
- */
-function theme_tripal_panes_form_arrange_panes ($variables) {
-  $element = $variables['element'];
-
-  $rows = array();
-
-  foreach (element_children($element) as $id) {
-
-    // Add a custom class that can be identified by 'drupal_add_tabledrag'
-    $element[$id]['weight']['#attributes']['class'] = array('tripal_pane-item-weight');
-
-    $element[$id]['label']['#printed'] = FALSE;
-    $element[$id]['weight']['#printed'] = FALSE;
-    $element[$id]['newlabel']['#printed'] = FALSE;
-    $element[$id]['rename']['#printed'] = FALSE;
-    $element[$id]['remove']['#printed'] = FALSE;
-
-    $rows[] = array(
-      'data' => array(
-        drupal_render($element[$id]['label']),
-        drupal_render($element[$id]['weight']),
-        drupal_render($element[$id]['newlabel']),
-        drupal_render($element[$id]['rename']),
-        drupal_render($element[$id]['remove'])
-      ),
-      // Add draggable to each row to support the tabledrag behaviour
-      'class' => array('draggable'),
-    );
-  }
-
-  // Create table header
-  $header = array(t('pane'), t('Weight'), array('data' => t('Rename'), 'colspan' => 2), t('Action'));
-
-  // Create a unique id for drupal_add_tabledrag() to find the table object
-  $table_id = 'tripal_pane-arrange_pane_table';
-
-  // Create output
-  $output = '';
-  if (count($rows) > 0) {
-    $output = theme('table', array(
-      'header' => $header,
-      'rows' => $rows,
-      'attributes' => array('id' => $table_id),
-    ));
-  }
-
-  // Call to the drupal_add_tabledrag
-  drupal_add_tabledrag($table_id, 'order', 'sibling', 'tripal_pane-item-weight');
-
-  return $output;
-}
-
-/**
- * Configure panes
- */
-function tripal_panes_action_configure_panes (&$form, &$form_state) {
-  $panes = $form_state['values']['pane_items'];
-
-  foreach ($panes AS $id => $pane) {
-    $table_layout = array();
-    foreach($pane AS $key => $value) {
-      // Save layout information
-      if (is_array($value) && key_exists('table_group', $value)) {
-        if ($value['table_group'] == 1) {
-          $table_layout[] = $key;
-        }
-      }
-      // Save CSS class for each field if provided
-      if (is_array($value) && key_exists('css_class', $value) && $value['css_class']) {
-        db_update('tripal_pane_fields')
-          ->fields(array(
-            'css_class' => $value['css_class']
-          ))
-          ->condition('pane_id',$id)
-          ->condition('field_id', $value['field_id'])
-          ->execute();
-      }
-    }
-    $pane_settings = db_select('tripal_panes', 'tp')
-      ->fields('tp', array('settings'))
-      ->condition('pane_id', $id)
-      ->execute()
-      ->fetchField();
-    $new_settings = unserialize($pane_settings);
-    $new_settings['table_layout'] = $table_layout;
-    db_update('tripal_panes')
-      ->fields(array(
-        'settings' => serialize($new_settings)
-      ))
-      ->condition('pane_id', $id)
-      ->execute();
-  }
-}
-
-/**
- *  Theme the Configure panes as a table
- *
- * @param unknown $variables
- * @return unknown
- */
-function theme_tripal_panes_form_configure_panes ($variables) {
-  $element = $variables['element'];
-
-  $rows = array();
-
-  foreach (element_children($element) as $id) {
-
-    $element[$id]['table_group']['#printed'] = FALSE;
-    $element[$id]['css_class']['#printed'] = FALSE;
-    $rows[] = array(
-      'data' => array(
-        $element[$id]['#title'],
-        drupal_render($element[$id]['table_group']),
-        drupal_render($element[$id]['css_class']),
-      ),
-    );
-  }
-
-  // Create table header
-  $header = array(t('Field'), t('Layout'), t('CSS Classes'));
-
-  // Create a unique id for drupal_add_tabledrag() to find the table object
-  $table_id = 'tripal_pane-configure_pane_table-' . strtolower(preg_replace('/\s+/', '_', $element['#title']));
-  $table_class = 'tripal_pane-configure_pane_table';
-
-  // Create output
-  $table = '';
-  if (count($rows) > 0) {
-    $table = theme('table', array(
-      'header' => $header,
-      'rows' => $rows,
-      'attributes' => array('id' => $table_id, 'class' => array($table_class)),
-    ));
-  }
-
-  $collapsible_item = array('element' => array());
-  $collapsible_item['element']['#children'] = '';
-  $collapsible_item['element']['#description'] =
-    '<div id="tripal_panes-pane_configure-fieldset-instruction">
-        Select a layout to organize fields into table(s) in this pane. Optionally, You can assign CSS classes to each field which allows styling multiple fields at a time. Please separate classes with a space.
-     <div>'
-    . $table;
-  $collapsible_item['element']['#title'] = $element['#title'];
-  // add 'collapsible' to the class setting to enable collapsible fieldset
-  $collapsible_item['element']['#attributes']['class'] = array('tripal_panes-pane_configure-fieldset');
-  $output = theme('fieldset', $collapsible_item);
-  return $output;
-}
-
-/**
- * Implements hook_theme().
- */
-function tripal_panes_theme($existing, $type, $theme, $path) {
-  return array(
-    'tripal_panes_form_arrange_panes' => array(
-      'render element' => 'element',
-    ),
-    'tripal_panes_form_configure_panes' => array(
-      'render element' => 'element',
-    ),
-    'tripal_panes_generic' => array(
-      'render element' => 'element',
-      'template' => 'tripal_panes_generic',
-      'path' => "$path/theme/templates",
-    ),
-  );
-}
-
-/**
- * Implements hook_entity_view.
- */
-function tripal_panes_entity_view($entity, $type, $view_mode, $langcode) {
-  switch ($type) {
-    case 'TripalEntity':
-      // Use the generic template to render the fields
-      if ($view_mode == 'full') {
-
-        $bundle = db_select('tripal_bundle', 'tb')
-          ->fields('tb', array('id', 'name', 'label'))
-          ->condition('name', $entity->bundle)
-          ->execute()
-          ->fetchObject();
-
-        tripal_panes_check_default_field_panes($bundle);
-
-        $results = db_select('tripal_panes', 'tp')
-          ->fields('tp', array('pane_id','name', 'label', 'settings'))
-          ->condition('bundle_id', $bundle->id)
-          ->orderBy('tp.weight', 'ASC')
-          ->execute();
-
-        $panes = array();
-        $fields = array();
-        $disabled_pane_id = 0;
-        foreach ($results AS $row) {
-          if ($row->name == 'te_disabled') {
-            $disabled_pane_id = $row->pane_id;
-          }
-          else {
-            $panes[$row->pane_id] = $row;
-            $fields[$row->pane_id] = array();
-          }
-        }
-
-        // Organize fields into panes
-        foreach (element_children($entity->content) as $field_name) {
-          $field_instance = field_info_instance ($type, $field_name, $entity->bundle);
-          // Get default pane_id
-          $default_pane_id = db_select('tripal_panes', 'tp')
-            ->fields('tp', array('pane_id'))
-            ->condition('bundle_id', $bundle->id)
-            ->condition('name', 'te_base')
-            ->execute()
-            ->fetchField();
-          // Get pane_id for the field
-          $pane_id = db_select('tripal_pane_fields', 'tpf')
-            ->fields('tpf', array('pane_id'))
-            ->condition('field_id', $field_instance['id'])
-            ->execute()
-            ->fetchField();
-          $pane_id = $pane_id ? $pane_id : $default_pane_id;
-          // Do not show disabled fields
-          if ($pane_id != $disabled_pane_id) {
-            // Construct field elements
-            $fields[$pane_id][$field_name] = $entity->content[$field_name];
-
-            // Add extra css classes
-            $css_class = db_select('tripal_pane_fields', 'tpf')
-              ->fields('tpf', array('css_class'))
-              ->condition('pane_id', $pane_id)
-              ->condition('field_id', $field_instance['id'])
-              ->execute()
-              ->fetchField();
-              $fields[$pane_id][$field_name]['#css_class'] = $css_class;
-          }
-          // Unset the field
-          unset ($entity->content[$field_name]);
-        }
-        drupal_add_css(drupal_get_path('module','tripal_panes') . '/theme/css/tripal_panes.css');
-        $entity->content['tripal_panes_generic'] = array(
-          '#theme' => 'tripal_panes_generic',
-          '#bundle' => $bundle,
-          '#panes' => $panes,
-          '#fields' => $fields,
-        );
-      }
-
-      break;
-  }
-}
-
-/**
- * Ajax callback to return pane's form elements when configuring pane
- */
-function tripal_panes_ajax_get_pane_setting_fieldset($form, &$form_state) {
-  $pane_id = $form_state['values']['pane_select'];
-  return  $form['te_configure_panes']['pane_items'];
-}