function tripal_core_exclude_type_by_default

2.x tripal_core.module tripal_core_exclude_type_by_default()
1.x tripal_core_chado.api.inc tripal_core_exclude_type_by_default()

Implements hook_exclude_type_by_default()

This hooks allows fields of a specified type that match a specified criteria to be excluded by default from any table when tripal_core_generate_chado_var() is called. Keep in mind that if fields are excluded by default they can always be expanded at a later date using tripal_core_expand_chado_vars().

Criteria are php strings that evaluate to either TRUE or FALSE. These strings are evaluated using drupal_eval() which suppresses syntax errors and throws watchdog entries of type php. There are also watchdog entries of type tripal_core stating the exact criteria evaluated. Criteria can contain the following tokens:

  • >field_name< Replaced by the name of the field to be excluded
  • >field_value< Replaced by the value of the field in the current record

Also keep in mind that if your criteria doesn't contain the >field_value< token then it will be evaluated before the query is executed and if the field is excluded it won't be included in the query.

Return value

An array of type => criteria where the type is excluded if the criteria evaluates to TRUE

Related topics

File

tripal_core/api/tripal_core_chado.api.inc, line 2304
The Tripal Core API

Code

function tripal_core_exclude_type_by_default() {
  return array('text' => 'strlen(">field_value< ") > 100');
}