|
@@ -25,6 +25,13 @@ class TripalField {
|
|
|
// changed.
|
|
|
public static $default_settings = array(
|
|
|
'storage' => 'tripal_no_storage',
|
|
|
+ // It is expected that all fields set a 'value' in the load() function.
|
|
|
+ // In many cases, the value may be an associative array of key/value pairs.
|
|
|
+ // In order for Tripal to provide context for all data, the keys should
|
|
|
+ // be a controlled vocabulary term (e.g. rdfs:type). Keys in the load()
|
|
|
+ // function that are supported by the query() function should be
|
|
|
+ // listed here.
|
|
|
+ 'searchable_keys' => array(),
|
|
|
);
|
|
|
|
|
|
// Provide a list of instance specific settings. These can be access within
|
|
@@ -67,6 +74,7 @@ class TripalField {
|
|
|
// and field_create_instance().
|
|
|
public static $no_ui = TRUE;
|
|
|
|
|
|
+
|
|
|
// --------------------------------------------------------------------------
|
|
|
// PROTECTED CLASS MEMBERS -- DO NOT OVERRIDE
|
|
|
// --------------------------------------------------------------------------
|
|
@@ -111,7 +119,6 @@ class TripalField {
|
|
|
$accession = $instance['settings']['term_accession'];
|
|
|
$term = tripal_get_term_details($vocabulary, $accession);
|
|
|
if (!$term) {
|
|
|
- dpm(debug_backtrace());
|
|
|
throw new Error(t('Cannot create TripalField of type "%term" as that
|
|
|
term does not exist.', array('%term' => "$vocabulary:$accession")));
|
|
|
}
|
|
@@ -288,7 +295,7 @@ class TripalField {
|
|
|
'click sortable' => TRUE,
|
|
|
),
|
|
|
'filter' => array(
|
|
|
- 'handler' => 'views_handler_filter_string',
|
|
|
+ 'handler' => 'tripal_views_handler_filter_string',
|
|
|
),
|
|
|
'sort' => array(
|
|
|
'handler' => 'views_handler_sort',
|
|
@@ -370,4 +377,43 @@ class TripalField {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Used to filter records that match a given condition.
|
|
|
+ *
|
|
|
+ * Entities can be filtered using the fields. This function should be
|
|
|
+ * implemented if the field supports filtering. To provide filtering,
|
|
|
+ * the $query object should be updated to including any joins and
|
|
|
+ * conditions necessary. The following rules should be followed when
|
|
|
+ * implementing this function:
|
|
|
+ * - Any keys from the value array that support filtering should be set
|
|
|
+ * in the $default_settings['searchable_keys'] array of this class file.
|
|
|
+ * - Implement support for every key in the
|
|
|
+ * $default_settings['searchable_keys'] array.
|
|
|
+ * - However, avoid making filteres for non-indexed database columns.
|
|
|
+ * - This function should never set the fields that should be returned
|
|
|
+ * nor ordering or group by.
|
|
|
+ *
|
|
|
+ * @param $query
|
|
|
+ * A query object appropriate for the data storage backend. For example,
|
|
|
+ * The Tripal Chado module will provide a SelectQuery object.
|
|
|
+ * @param $condition
|
|
|
+ * The field specific condition as set in the TripalFieldQuery object.
|
|
|
+ */
|
|
|
+ public function query($query, $condition) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Used to sort records that have been filtered.
|
|
|
+ *
|
|
|
+ * @param $query
|
|
|
+ * A query object appropriate for the data storage backend. For example,
|
|
|
+ * The Tripal Chado module will provide a SelectQuery object.
|
|
|
+ * @param $order
|
|
|
+ * The field ordering as set in the TripalFieldQuery object. This function
|
|
|
+ * should handle the ordering request as specified by this object.
|
|
|
+ */
|
|
|
+ public function queryOrder($query, $order) {
|
|
|
+
|
|
|
+ }
|
|
|
}
|