Stephen Ficklin hace 6 años
padre
commit
c244020a98

+ 149 - 40
tripal/api/tripal.entities.api.inc

@@ -1007,14 +1007,14 @@ function tripal_get_default_title_format($bundle) {
 /**
  * Returns an array of tokens based on Tripal Entity Fields.
  *
- * @param TripalBundle $entity
+ * @param TripalBundle $bundle
  *    The bundle entity for which you want tokens.
  * @return
  *    An array of tokens where the key is the machine_name of the token.
  *
  * @ingroup tripal_entities_api
  */
-function tripal_get_entity_tokens($entity, $options = array()) {
+function tripal_get_entity_tokens($bundle, $options = array()) {
   $tokens = array();
 
   // Set default options.
@@ -1023,51 +1023,132 @@ function tripal_get_entity_tokens($entity, $options = array()) {
 
   if ($options['include id']) {
     $token = '[TripalBundle__bundle_id]';
-    $tokens[$token] = array(
+    $tokens[$token] = [
       'label' => 'Bundle ID',
       'description' => 'The unique identifier for this Tripal Content Type.',
       'token' => $token,
       'field_name' => NULL,
       'required' => TRUE
-    );
+    ];
 
     $token = '[TripalEntity__entity_id]';
-    $tokens[$token] = array(
+    $tokens[$token] = [
       'label' => 'Content/Entity ID',
       'description' => 'The unique identifier for an individual piece of Tripal Content.',
       'token' => $token,
       'field_name' => NULL,
       'required' => TRUE
-    );
+    ];
   }
 
-  $fields = field_info_instances('TripalEntity', $entity->name);
-  foreach ($fields as $f) {
-
-    // Build the token from the field information.
-    $token = '[' . $f['field_name'] . ']';
-    $current_token = array(
-      'label' => $f['label'],
-      'description' => $f['description'],
-      'token' => $token,
-      'field_name' => $f['field_name'],
-      'required' => $f['required']
-    );
-
-    // If the required only option is set then we only want to add
-    // required fields to the token list.
-    if ($options['required only'] AND $current_token['required']) {
-      $tokens[$token] = $current_token;
+  $instances = field_info_instances('TripalEntity', $bundle->name);
+  foreach ($instances as $instance_name => $instance) {
+    
+    if (!$instance['required'] and $options['required only']) {
+      continue;
+    }
+    
+    $use_field = FALSE;
+   
+    // Iterate through the TripalEntity fields and see if they have
+    // sub-elements, if so, add those as tokens too.
+    $field_name = $instance['field_name'];
+    if ($instance['entity_type'] == 'TripalEntity') {
+      if (tripal_load_include_field_class($field_name)) {
+        $field = field_info_field($field_name);
+        $field_obj = new $field_name($field, $instance);
+        $element_info = $field_obj->elementInfo();
+        $term_id = $instance['settings']['term_vocabulary'] . ':' . $instance['settings']['term_accession'];
+        if ($element_info and 
+            array_key_exists($term_id, $element_info) and 
+            array_key_exists('elements', $element_info[$term_id]) and count($element_info[$term_id]['elements']) > 0) {
+          $elements = $element_info[$term_id]['elements'];
+          _tripal_get_entity_tokens_for_elements($instance, $field_name, $elements, $tokens, $options);
+        }
+        else {
+          $use_field = TRUE;
+        }
+      }
+      else {
+        $use_field = TRUE;
+      }
+    }
+    else {
+      $use_field = TRUE;
     }
-    // If the required only option is not set then add everything.
-    elseif (!$options['required only']) {
-      $tokens[$token] = $current_token;
+    
+    // If we have no elements to add then just add the field as is.
+    if ($use_field) {
+      // Build the token from the field information.
+      $token = '[' . $instance['field_name'] . ']';
+      $tokens[$token] = [
+        'label' => $instance['label'],
+        'description' => $instance['description'],
+        'token' => $token,
+        'field_name' => $instance['field_name'],
+        'required' => $instance['required']
+      ];
     }
   }
 
   return $tokens;
 }
 
+/**
+ * A recursive helper function to get tokens for element sub fields.
+ * 
+ * @param $instance
+ *   A original field instance object.
+ * @param $parent
+ *   The name of the parent. The first time this is called outside of 
+ *   recursion this should be the field name.
+ * @param $elements
+ *   The array of elements to process.
+ * @param $tokens
+ *   The array of tokens to be added to.
+ */
+function _tripal_get_entity_tokens_for_elements($instance, $parent, $elements, &$tokens, $options) {
+  
+  // Iterate through all of the elements and add tokens for each one.
+  foreach ($elements as $child_term_id => $details) {
+    
+    // We don't need to add the entity element.
+    if ($child_term_id == 'entity') {
+      continue;
+    }
+    
+    // Skip elements that aren't required.
+    $required = array_key_exists('required', $details) ? $details['required'] : FALSE;
+    if (!$required and $options['required only']) {
+      continue;
+    }
+    $token = '[' . $parent . ',' . $child_term_id . ']'; 
+    $label = $child_term_id;
+    if (array_key_exists('name', $details)) {
+      $label = $details['name'];
+    }
+    elseif (preg_match('/:/', $child_term_id)) {
+      list($vocabulary, $accession) = explode(':', $child_term_id);
+      $term = tripal_get_term_details($vocabulary, $accession);
+      $label = $term['name'];
+    }
+
+    // Add the token!
+    $tokens[$token] = [
+      'label' => $label,
+      'description' => array_key_exists('description', $details) ? $details['description'] : '',
+      'token' => $token,
+      'field_name' => $instance['field_name'],
+      'required' => $required
+    ];
+    
+    // Recurse to include sub elements
+    if (array_key_exists('elements', $details)) {
+      _tripal_get_entity_tokens_for_elements($instance, $parent . ',' . $child_term_id, 
+        $details['elements'], $tokens, $options);
+    }
+  }
+}
 /**
  * Replace all Tripal Tokens in a given string.
  *
@@ -1088,8 +1169,8 @@ function tripal_get_entity_tokens($entity, $options = array()) {
  */
 function tripal_replace_entity_tokens($string, &$entity, $bundle_entity = NULL) {
   // Determine which tokens were used in the format string
-  $used_tokens = array();
-  if (preg_match_all('/\[\w+\]/', $string, $matches)) {
+  $used_tokens = [];
+  if (preg_match_all('/\[.*?\]/', $string, $matches)) {
     $used_tokens = $matches[0];
   }
 
@@ -1104,10 +1185,13 @@ function tripal_replace_entity_tokens($string, &$entity, $bundle_entity = NULL)
   // all synced entities causes extreme slowness, so we'll only attach
   // the necessary fields for replacing tokens.
   $attach_fields = array();
-  foreach($used_tokens as $token) {
-    $field_name = str_replace(array('.','[',']'), array('__','',''), $token);
 
-    if (!property_exists($entity, $field_name)) {
+  foreach($used_tokens as $token) {
+    $token = preg_replace('/[\[\]]/', '', $token);
+    $elements = explode(',', $token);
+    $field_name = array_shift($elements);
+    //$field_name = str_replace(array('.','[',']'), array('__','',''), $field_name);
+    if (!property_exists($entity, $field_name) or empty($entity->{$field_name})) {
       $field = field_info_field($field_name);
       $storage = $field['storage'];
       $attach_fields[$storage['type']]['storage'] = $storage;
@@ -1129,20 +1213,28 @@ function tripal_replace_entity_tokens($string, &$entity, $bundle_entity = NULL)
     module_invoke($storage['module'], 'field_storage_load', 'TripalEntity',
         $entities, FIELD_LOAD_CURRENT, $field_ids, array());
   }
-
+  
   // Now that all necessary fields are attached process the tokens.
   foreach($used_tokens as $token) {
-    $field_name = str_replace(array('.','[',']'), array('__','',''), $token);
+    $token = preg_replace('/[\[\]]/', '', $token);
+    $elements = explode(',', $token);
+    $field_name = array_shift($elements);
     $value = '';
-
+    
     if (property_exists($entity, $field_name)) {
+      $value = '';
       // Note: there is a memory leak in field_get_items() so we can't use it
       // here or bulk publishing will slowly erode memory.
-      //$field_value = field_get_items('TripalEntity', $entity, $field_name);
-      if (array_key_exists(0, $entity->{$field_name}['und'])) {
+      // $field_value = field_get_items('TripalEntity', $entity, $field_name);
+      if (array_key_exists('und', $entity->{$field_name}) and 
+          array_key_exists(0, $entity->{$field_name}['und'])) {
         $value = $entity->{$field_name}['und'][0]['value'];
-      }
-      // TODO: deal with the value when it is not a scalar.
+        // If the value is an array it means we have sub elements and we can
+        // descend through the array to look for matching value.
+        if (is_array($value) and count($elements) > 0) {
+          $value = _tripal_replace_entity_tokens_for_elements($elements, $value);
+        }
+      }    
     }
     // The TripalBundle__bundle_id is a special token for substituting the
     // bundle id.
@@ -1163,16 +1255,33 @@ function tripal_replace_entity_tokens($string, &$entity, $bundle_entity = NULL)
 
     // We can't support tokens that have multiple elements (i.e. in an array).
     if (is_array($value)) {
-      $string = str_replace($token, '', $string);
+      $string = str_replace('[' . $token . ']', '', $string);
     }
     else {
-      $string = str_replace($token, $value, $string);
+      $string = str_replace('[' . $token . ']', $value, $string);
     }
   }
 
   return $string;
 }
 
+/**
+ * A helper function for tripal_replace_entity_tokens to get token values.
+ * 
+ * This helper function is used when the tokens are from subelements.
+ * @param $entity
+ */
+function _tripal_replace_entity_tokens_for_elements($elements, $values) {
+  $term_id = array_shift($elements);
+  $value = $values[$term_id];
+  if (count($elements) == 0) {
+    return $value;
+  }
+  else {
+    _tripal_replace_entity_tokens_for_elements($elements, $value);
+  }
+}
+
 /**
  * Formats the tokens for display.
  *

+ 1 - 0
tripal/api/tripal.jobs.api.inc

@@ -415,6 +415,7 @@ function tripal_launch_job($do_parallel = 0, $job_id = NULL, $max_jobs = -1, $si
 
     // Run the job
     $callback = $job->getCallback();
+    print date('Y-m-d H:i:s') . ": Job ID " . $job_id . ".\n";
     print date('Y-m-d H:i:s') .": Calling: $callback(" . implode(", ", $string_args) . ")\n";
     try {
       $job->run();

+ 6 - 5
tripal/includes/TripalBundleUIController.inc

@@ -347,7 +347,8 @@ function tripal_tripal_bundle_form($form, &$form_state, $entityDataType) {
   $form['url']['token_display'] = array(
     '#type' => 'fieldset',
     '#title' => t('Available Tokens'),
-    '#description' => t('Copy the token and paste it into the "URL Alias Pattern" text field above.'),
+    '#description' => t('Copy the token and paste it into the "URL Alias Pattern" ' . 
+      'text field above. Please choose tokens that will guarantee a unique URL.'),
     '#collapsible' => TRUE,
     '#collapsed' => TRUE
   );
@@ -488,8 +489,8 @@ function tripal_tripal_bundle_form_submit($form, &$form_state) {
       $includes = array(
         module_load_include('inc', 'tripal', 'includes/tripal.bulk_update'),
       );
-      tripal_add_job('Update all aliases', 'tripal', 'tripal_update_all_urls_and_titles', $args,
-        $user->uid, 10, $includes);
+      tripal_add_job('Update all aliases for content type: ' . $bundle->label, 'tripal', 
+        'tripal_update_all_urls_and_titles', $args, $user->uid, 10, $includes);
     }
     elseif ($trigger == 'Bulk update all aliases'){
       $update = $form_state['input']['url']['url_pattern'];
@@ -502,8 +503,8 @@ function tripal_tripal_bundle_form_submit($form, &$form_state) {
       $includes = array(
         module_load_include('inc', 'tripal', 'includes/tripal.bulk_update'),
       );
-      tripal_add_job('Update all aliases', 'tripal', 'tripal_update_all_urls_and_titles', $args,
-        $user->uid, 10, $includes);
+      tripal_add_job('Update all aliases for content type: ' . $bundle->label, 'tripal', 
+        'tripal_update_all_urls_and_titles', $args, $user->uid, 10, $includes);
     }
 
     $form_state['redirect'] = 'admin/structure/bio_data';

+ 32 - 41
tripal/includes/TripalEntityController.inc

@@ -100,30 +100,23 @@ class TripalEntityController extends EntityAPIController {
    * Sets the title for an entity.
    *
    * @param $entity
+   *   The entity whose title should be changed.
    * @param $title
+   *   The title to use. It can contain tokens the correspond to field values.
+   *   Token should be be compatible with those returned by 
+   *   tripal_get_entity_tokens().
    */
   public function setTitle($entity, $title = NULL) {
-
+    
+    $bundle = tripal_load_bundle_entity(array('name' => $entity->bundle));
+    
     // If no title was supplied then we should try to generate one using the
     // default format set by admins.
-    if (!$title) {
-      // Load the TripalBundle entity for this TripalEntity.
-      // Get the format for the title based on the bundle of the entity.
-      // And then replace all the tokens with values from the entity fields.
-      $bundle_entity = tripal_load_bundle_entity(array('name' => $entity->bundle));
+    if (!$title) {     
       $title = tripal_get_title_format($bundle_entity);
-      $title = tripal_replace_entity_tokens($title, $entity, $bundle_entity);
-    }
-    // Check if the passed alias has tokens.
-    if($title && (preg_match_all("/\[[^\]]*\]/", $title, $bundle_tokens))) {
-
-      // Load the TripalBundle entity for this TripalEntity.
-      $bundle_entity = tripal_load_bundle_entity(array('name' => $entity->bundle));
-
-      // And then replace all the tokens with values from the entity fields.
-      $title = tripal_replace_entity_tokens($title, $entity, $bundle_entity);
     }
-    // As long as we were able to determine a title, we should update it ;-).
+    $title = tripal_replace_entity_tokens($title, $entity, $bundle_entity);
+    
     if ($title) {
       db_update('tripal_entity')
         ->fields(array(
@@ -136,6 +129,13 @@ class TripalEntityController extends EntityAPIController {
 
   /**
    * Sets the URL alias for an entity.
+   * 
+   * @param $entity
+   *   The entity whose URL alias should be changed.
+   * @param $alias
+   *   The alias to use. It can contain tokens the correspond to field values.
+   *   Token should be be compatible with those returned by 
+   *   tripal_get_entity_tokens().
    */
   public function setAlias($entity, $alias = NULL) {
     $source_url = "bio_data/$entity->id";
@@ -145,12 +145,10 @@ class TripalEntityController extends EntityAPIController {
     if (!$alias) {
 
       // Load the TripalBundle entity for this TripalEntity.
-      $bundle_entity = tripal_load_bundle_entity(array('name' => $entity->bundle));
-
       // First get the format for the url alias based on the bundle of the entity.
+      // Then replace all the tokens with values from the entity fields.
+      $bundle_entity = tripal_load_bundle_entity(array('name' => $entity->bundle));
       $alias = tripal_get_bundle_variable('url_format', $bundle_entity->id);
-
-      // And then replace all the tokens with values from the entity fields.
       $alias = tripal_replace_entity_tokens($alias, $entity, $bundle_entity);
     }
 
@@ -158,31 +156,28 @@ class TripalEntityController extends EntityAPIController {
     // the term name and entity id.
     if (!$alias) {
 
-      // Load the term for this TripalEntity.
+      // Load the term for this TripalEntity. Set a default based on the term 
+      // name and entity id. Then replace all the tokens with values from 
+      // the entity fields.
       $term = entity_load('TripalTerm', array('id' => $entity->term_id));
       $term = reset($term);
-
-      // Set a default based on the term name and entity id.
       $alias = str_replace(' ', '', $term->name) . '/[TripalEntity__entity_id]';
-
-      // And then replace all the tokens with values from the entity fields.
       $alias = tripal_replace_entity_tokens($alias, $entity, $bundle_entity);
     }
-    // Check if the passed alias has tokens.
+    
+    // Check if the passed alias has tokens. Load the TripalBundle entity for 
+    // this TripalEntity. Then replace all the tokens with values from the 
+    // entity fields.
     if($alias && (preg_match_all("/\[[^\]]*\]/", $alias, $bundle_tokens))) {
-
-      // Load the TripalBundle entity for this TripalEntity.
       $bundle_entity = tripal_load_bundle_entity(array('name' => $entity->bundle));
-
-      // And then replace all the tokens with values from the entity fields.
       $alias = tripal_replace_entity_tokens($alias, $entity, $bundle_entity);
     }
 
     // Make sure the alias doesn't contain spaces.
-    $alias = preg_replace('/\s+/','-',$alias);
+    //$alias = preg_replace('/\s+/','-',$alias);
     // Or any non alpha numeric characters.
-    $alias = preg_replace('/[^a-zA-Z0-9\-\/]/','',$alias);
-    $alias = preg_replace('/_/','-',$alias);
+    //$alias = preg_replace('/[^a-zA-Z0-9\-\/]/','',$alias);
+    //$alias = preg_replace('/_/','-',$alias);
 
     if ($alias) {
       // Determine if this alias has already been used.
@@ -210,10 +205,7 @@ class TripalEntityController extends EntityAPIController {
           'language' => 'und',
         );
 
-//        path_delete(array('source' => $source_url));
-//        $path = array('source' => $source_url, 'alias' => $alias);
-//        path_save($path);
-        //Now check if an entry with the source url for this entity already
+        // Now check if an entry with the source url for this entity already
         // exists. This is an issue when updating existing url aliases. To avoid
         // creating 404s existing aliases need to be updated and a redirect
         // created to handle the old alias.
@@ -246,15 +238,14 @@ class TripalEntityController extends EntityAPIController {
               ->condition('source', $source_url, '=')
               ->condition('pid', $ea->pid, '=')
               ->execute();
-
           }
         }
         else {
           drupal_write_record('url_alias', $values);
         }
       }
-      // If there is only one alias matching then it might just be that we already
-      // assigned this alias to this entity in a previous save.
+      // If there is only one alias matching then it might just be that we 
+      // already assigned this alias to this entity in a previous save.
       elseif ($num_aliases == 1) {
 
         $bundle_entity = tripal_load_bundle_entity(array('name' => $entity->bundle));

+ 1 - 1
tripal/includes/TripalJob.inc

@@ -160,7 +160,7 @@ class TripalJob {
     }
 
     $includes = $details['includes'];
-    if ($path and is_array($path)) {
+    if ($includes and is_array($includes)) {
       foreach ($includes as $path) {
         $full_path = $_SERVER['DOCUMENT_ROOT'] . base_path() . $path;
         if (!empty($path)) {

+ 7 - 6
tripal/includes/tripal.bulk_update.inc

@@ -8,6 +8,7 @@
  * @param $type
  */
 function tripal_update_all_urls_and_titles($bundle_id, $update, $type) {
+
   // Load all the entity_ids.
   $entity_table = 'chado_'.$bundle_id;
   $entities = db_select($entity_table, 'e')
@@ -15,16 +16,16 @@ function tripal_update_all_urls_and_titles($bundle_id, $update, $type) {
     ->orderBy('entity_id', 'ASC')
     ->execute();
   $num_entities = $entities->rowCount();
+  
   // Parse the $update variable for tokens and load those tokens.
-  preg_match_all("/\[[^\]]*\]/", $update, $bundle_tokens);
+  preg_match_all("'/\[.*?\]/'", $update, $bundle_tokens);
 
   $fields = array();
   foreach ($bundle_tokens as $bundle_token) {
-    foreach ($bundle_token as $token) {
-      $string = str_replace(array('[', ']'), '', $token);
-      $field_array = field_info_field($string);
-      $fields[] = $field_array['id'];
-    }
+    $elements = explode(',', $token);
+    $field_name = array_shift($elements);
+    $field_array = field_info_field($field_name);
+    $fields[] = $field_array['id'];
   }
 
   $i = 1;

+ 3 - 142
tripal_ws/includes/TripalFields/remote__data/remote__data_widget.inc

@@ -6,152 +6,13 @@ class remote__data_widget extends WebServicesFieldWidget {
   public static $default_label = 'Remote Data';
   // The list of field types for which this formatter is appropriate.
   public static $field_types = array('remote__data');
+ 
   /**
-   * Provides the form for editing of this field.
-   *
-   * This function corresponds to the hook_field_widget_form()
-   * function of the Drupal Field API.
-   *
-   * This form is diplayed when the user creates a new entity or edits an
-   * existing entity.  If the field is attached to the entity then the form
-   * provided by this function will be displayed.
-   *
-   * At a minimum, the form must have a 'value' element.  For Tripal, the
-   * 'value' element of a field always corresponds to the value that is
-   * presented to the end-user either directly on the page (with formatting)
-   * or via web services, or some other mechanism.  However, the 'value' is
-   * sometimes not enough for a field.  For example, the Tripal Chado module
-   * maps fields to table columns and sometimes those columns are foreign keys
-   * therefore, the Tripal Chado modules does not just use the 'value' but adds
-   * additional elements to help link records via FKs.  But even in this case
-   * the 'value' element must always be present in the return form and in such
-   * cases it's value should be set equal to that added in the 'load' function.
-   *
-   * @param $widget
-   * @param $form
-   *   The form structure where widgets are being attached to. This might be a
-   *   full form structure, or a sub-element of a larger form.
-   * @param $form_state
-   *   An associative array containing the current state of the form.
-   * @param $langcode
-   *   The language associated with $items.
-   * @param $items
-   *   Array of default values for this field.
-   * @param $delta
-   *   The order of this item in the array of subelements (0, 1, 2, etc).
-   * @param $element
-   * A form element array containing basic properties for the widget:
-   *  - #entity_type: The name of the entity the field is attached to.
-   *  - #bundle: The name of the field bundle the field is contained in.
-   *  - #field_name: The name of the field.
-   *  - #language: The language the field is being edited in.
-   *  - #field_parents: The 'parents' space for the field in the form. Most
-   *    widgets can simply overlook this property. This identifies the location
-   *    where the field values are placed within $form_state['values'], and is
-   *    used to access processing information for the field through the
-   *    field_form_get_state() and field_form_set_state() functions.
-   *  - #columns: A list of field storage columns of the field.
-   *  - #title: The sanitized element label for the field instance, ready for
-   *    output.
-   *  - #description: The sanitized element description for the field instance,
-   *    ready for output.
-   *  - #required: A Boolean indicating whether the element value is required;
-   *    for required multiple value fields, only the first widget's values are
-   *    required.
-   *  - #delta: The order of this item in the array of subelements; see
-   *    $delta above
+   * @see TripalFieldWidget::form()
    */
   public function form(&$widget, &$form, &$form_state, $langcode, $items, $delta, $element) {
     parent::form($widget, $form, $form_state, $langcode, $items, $delta, $element);
-    // Get the field settings.
-   /* $field_name = $this->field['field_name'];
-    $field_type = $this->field['type'];
-
-    // Get the setting for the option for how this widget.
-    $instance = $this->instance;
-    $settings = '';
-    $site_list = '';
-
-    $tokens = array();
-    // Get the form info from the bundle about to be saved.
-    $bundle_info = tripal_load_bundle_entity(array('name' => $form_state['build_info']['args']['0']['bundle']));
-    // Retrieve all available tokens.
-    $tokens = tripal_get_entity_tokens($bundle_info);
-    // If the field already has a value then it will come through the $items
-    // array.  This happens when editing an existing record.
-
-    // FORM PROPER
-    $widget['#prefix'] =  "<span id='$field_name-remote_data-$delta'>";
-    $widget['#suffix'] =  "</span>";
-
-    $widget['value'] = array(
-      '#type' => 'value',
-      '#value' => array_key_exists($delta, $items) ? $items[$delta]['value'] : '',
-    );
-
-    $widget['data_info'] = array(
-      '#type' => 'fieldset',
-      '#title' => 'Remote Data Settings',
-      '#description' => 'Provide the site name, query and description for the remote data source.',
-      '#collapsible' => TRUE,
-      '#collapsed' => FALSE,
-      '#prefix' => "<div id='set_titles-fieldset'>",
-      '#suffix' => '</div>',
-    );
-
-    // Get the site info from the tripal_sites table.
-      // Get the field groups associated with this bundle.
-    $sites = db_select('tripal_sites', 's')
-      ->fields('s')
-      ->execute()->fetchAll();
-
-    foreach ($sites as $site) {
-      $rows[] = $site->name;
-    }
-
-    $widget['data_info']['site'] = array(
-      '#type' => 'select',
-      '#title' => t('Site'),
-      '#options' => $rows,
-      '#default_value' => $site_list,
-    );
-
-    $widget['data_info']['query'] = array(
-      '#type' => 'textarea',
-      '#title' => 'Query',
-      '#description' => 'Build the query string that should be appended after the url. The tokens
-       listed below may be used in your query build.',
-      '#default_value' => $this->instance['settings']['data_info']['query'],
-      '#rows' => 5
-    );
-
-    $widget['set_titles']['token_display']['tokens'] = array(
-      '#type' => 'hidden',
-      '#value' => serialize($tokens)
-    );
-
-    $widget['data_info']['token_display'] = array(
-      '#type' => 'fieldset',
-      '#title' => 'Available Tokens',
-      '#description' => 'Copy the token and paste it into the "Query" text field above.',
-      '#collapsible' => TRUE,
-      '#collapsed' => TRUE
-    );
-
-    $widget['data_info']['token_display']['content'] = array(
-      '#type' => 'item',
-      '#markup' => theme_token_list($tokens),
-    );
-
-    $widget['data_info']['description'] = array(
-      '#type' => 'textarea',
-      '#title' => 'Description',
-      '#description' => 'Describe the data being pulled in.',
-      '#default_value' =>  $this->instance['settings']['data_info']['description'],
-      '#rows' => 1
-    );
-*/
-    //TODO Add test button to ensure query returns info.
+    
   }
   /**
    * Performs validation of the widgetForm.