|
| chado_get_id_from_nid ($table, $nid, $linking_table=NULL) |
|
| chado_get_nid_from_id ($table, $id, $linking_table=NULL) |
|
| chado_node_get_base_table ($content_type, $module=FALSE) |
|
| chado_node_sync_form ($form, &$form_state) |
|
| chado_node_sync_records ($base_table, $max_sync=FALSE, $organism_id=FALSE, $types=[], $ids=[], $linking_table=FALSE, $node_type=FALSE, $job_id=NULL) |
|
| chado_cleanup_orphaned_nodes ($table, $nentries=25000, $linking_table=NULL, $node_type=NULL, $job_id=NULL) |
|
| chado_cleanup_orphaned_nodes_part ($table, $job_id=NULL, $nentries, $offset, $linking_table, $node_type) |
|
| hook_chado_node_sync_create_new_node ($new_node, $record) |
|
| hook_chado_node_sync_form ($form, &$form_state) |
|
| hook_chado_node_sync_form_submit ($form, $form_state) |
|
| hook_chado_node_sync_select_query ($query) |
|
| chado_add_node_form_dbxrefs (&$form, &$form_state, $details) |
|
| chado_retrieve_node_form_dbxrefs ($node) |
|
| chado_update_node_form_dbxrefs ($node, $details, $retrieved_dbxrefs=FALSE) |
|
| chado_add_node_form_properties (&$form, &$form_state, $details) |
|
| chado_retrieve_node_form_properties ($node) |
|
| chado_update_node_form_properties ($node, $details, $retrieved_properties=FALSE) |
|
| chado_add_node_form_relationships (&$form, &$form_state, $details) |
|
| chado_retrieve_node_form_relationships ($node) |
|
| chado_update_node_form_relationships ($node, $details, $retrieved_relationships=FALSE) |
|
| chado_get_node_title ($node) |
|
| chado_add_admin_form_set_title (&$form, &$form_state, $details) |
|
| chado_node_get_title_format ($content_type, &$tokens, $base_table=NULL) |
|
| chado_node_get_legacy_title_default ($content_type) |
|
| chado_get_node_url ($node) |
|
| chado_set_node_url ($node) |
|
| chado_update_existing_node_urls ($content_type, $job_id=0) |
|
| chado_add_admin_form_set_url (&$form, &$form_state, $details) |
|
| chado_node_get_url_format ($content_type, &$tokens, $base_table=NULL) |
|
| chado_node_get_legacy_url_default ($content_type) |
|
| chado_node_add_token_format ($application, $content_type, $format, $tokens) |
|
| chado_node_get_token_format ($application, $content_type, $options=[]) |
|
| chado_node_get_unique_constraint_format ($base_table, $format_type='title') |
|
| chado_node_generate_tokens ($base_table, $token_prefix=FALSE, $location_prefix=FALSE) |
|
| chado_get_token_value ($token_info, $node, $options=[]) |
|
Many Tripal modules implement Drupal node types as a means of displaying chado records individually through Drupal as a single web page. In order to do this, many of the same drupal hooks are implemented and the code between modules is actually quite similar. This API aims to abstract much of the common functionality in order to make it easier for new Tripal modules to implement drupal node types and to centralize the maintenance effort as much as possible.
A generic sync form has been created. See chado_node_sync_form() for instructions on how to implement this form in your module.
Many of the base chado tables also have associated prop, _dbxref and _relationship tables. Generic mini-forms have been created to help you handle these forms. To implement this functionality you call the mini-form from your module node form and then call the associated update functions from both your hook_insert and hook_update. The functions of interest are as follows:
◆ chado_add_admin_form_set_title()
chado_add_admin_form_set_title |
( |
& |
$form, |
|
|
& |
$form_state, |
|
|
|
$details |
|
) |
| |
Generic "Set Node Title" sub-form for setting the title of any chado node
- Parameters
-
$form | The Drupal form array into which the property form elements will be added |
$form_state | The corresponding form_state array for the form |
$details | An array defining details used by this form. Required keys that are always required: -module: the name of the module implementing the node. For example, for features the module is tripal_feature. -options: an array of quick-choice options to supply to the user. The key should be the token and the value should be a human-readable description of the option -content_type: the name of the content type. Defaults to module name. Optional keys include: -fieldset_title: the title to use for the fieldset. Defaults to "Set
Page Title". -default_option: the default format to use which matches one of those in $details['options'] -custom_tokens: an array of custom tokens that follow the same format as those generated by chado_node_generate_tokens(). |
◆ chado_add_admin_form_set_url()
chado_add_admin_form_set_url |
( |
& |
$form, |
|
|
& |
$form_state, |
|
|
|
$details |
|
) |
| |
Generic "Set Node URL" sub-form for setting the url of any chado node
- Parameters
-
$form | The Drupal form array into which the property form elements will be added |
$form_state | The corresponding form_state array for the form |
$details | An array defining details used by this form. Required keys that are always required: -module: the name of the module implementing the node. For example, for features the module is tripal_feature. -options: an array of quick-choice options to supply to the user. The key should be the token and the value should be a human-readable description of the option Optional keys include: -content_type: the name of the content type. Defaults to module name. -fieldset_title: the title to use for the fieldset. Defaults to "Set
Page url". -default_option: the default format to use which matches one of those in $details['options'] -custom_tokens: an array of custom tokens that follow the same format as those generated by chado_node_generate_tokens(). |
◆ chado_add_node_form_dbxrefs()
chado_add_node_form_dbxrefs |
( |
& |
$form, |
|
|
& |
$form_state, |
|
|
|
$details |
|
) |
| |
◆ chado_add_node_form_properties()
chado_add_node_form_properties |
( |
& |
$form, |
|
|
& |
$form_state, |
|
|
|
$details |
|
) |
| |
Provides a form for adding to BASEprop table
- Parameters
-
$form | The Drupal form array into which the property form elements will be added |
$form_state | The corresponding form_state array for the form |
$details | An array defining details used by this form. Required keys that are always required:
- property_table: the name of the property table (e.g.: featureprop, stockprop, etc.) Required keys for forms that update a record.
- chado_id: the id of the record to which properties will be associated (e.g.: if a feature has a feature_id of 999 and we want to associate properties for that feature then the chado_id option should be 999) Require ONE of the following to identify the controlled vocabulary containing the properties to use:
- cv_id: the unique key from the cv table
- cv_name: the cv.name field uniquely identifying the controlled vocabulary Optional keys include:
- chado_id_field: the foreign key field that links properties to the chado_id record. If this value is not specified it is determined using the traditional Chado naming scheme for property tables.
- additional_instructions: provides additional instructions to the user for dealing with the property elements. These instructions are appended to the default instructions
- fieldset_title: An alternate name for the fieldset in which the properties form is placed. By default the title is 'Properties'.
- default_properties: An array of properties used to initialize the properties form. Each property shoudl be represented as an array with the following keys and values: 'cvterm': The cvterm object for the property type 'value': The property value
- select_options: an array of terms to use for the drop down select box. this array will be used rather than populating the drop down with terms from the named vocabulary. The array must have keys with the cvterm_id and values with the cvterm name.
|
◆ chado_add_node_form_relationships()
chado_add_node_form_relationships |
( |
& |
$form, |
|
|
& |
$form_state, |
|
|
|
$details |
|
) |
| |
Provides a form for adding to BASE_relationship and relationship tables
- Parameters
-
$form | The Drupal form array into which the relationship elements will be added |
$form_state | The corresponding form_state array for the form |
$details | An array defining details needed by this form. Required Keys are:
- relationship_table: the name of the relationship table (ie: feature_relationship)
- base_table: the name of the base table (ie: feature)
- base_foreign_key: the name of the foreign key in the relationship table field linking this table to the non-relationship table (ie: feature_id)
- base_key_value: the value of the base_foreign_key for the current form (ie: 999 if the feature_id=999)
- nodetype: the non-translated singular title of this node type One of the following:
- cv_id: the id of the ontology to supply terms for the type dropdown
- cv_name: the name of the ontology to supply terms for the type dropdown Optional keys include:
- fieldset_title: the non-translated title for this fieldset
- additional_instructions: a non-translated string providing additional instructions
- nodetype_plural: the non-translated plural title of this node type
- select_options: must be an array where the [key] is a valid cvterm_id and the [value] is the human-readable name of the option. This is generated from the cv_name/id by default
- base_name_field: the field in your base table you want to be used as the name of the record
- subject_field_name: the name of the subject field in your relationship table (default: subject_id)
- object_field_name: the name of the object field in your relationship table (default: object_id)
|
◆ chado_cleanup_orphaned_nodes()
chado_cleanup_orphaned_nodes |
( |
|
$table, |
|
|
|
$nentries = 25000 , |
|
|
|
$linking_table = NULL , |
|
|
|
$node_type = NULL , |
|
|
|
$job_id = NULL |
|
) |
| |
This function is a wrapper for the chado_cleanup_orphaned_nodes function. It breaks up the work of chado_cleanup_orphaned_nodes into smaller pieces that are more managable for servers that may have low php memory settings.
- Parameters
-
$table | The name of the table that corresonds to the node type we want to clean up. |
$nentries | Optional. The number of entries to parse at one time (ie: the batch size). Set to zero if no limit is needed. |
$linking_table | Optional. The name of the linking table that maps Drupal nodes to Chado records. This is only required if the linking table name is not of the form: chado_[table] where [table] is the value provided to the $table argument. |
$node_type | Optional. The name of the node type for the records. This is only required if the node type is not of the form: chado_[table] where [table] is the value provided to the $table. |
$job_id | Optional. This should be the job id from the Tripal jobs system. Typically, only the Tripal jobs system will use the argument. |
◆ chado_cleanup_orphaned_nodes_part()
chado_cleanup_orphaned_nodes_part |
( |
|
$table, |
|
|
|
$job_id = NULL , |
|
|
|
$nentries, |
|
|
|
$offset, |
|
|
|
$linking_table, |
|
|
|
$node_type |
|
) |
| |
This function will delete Drupal nodes for any sync'ed table (e.g. feature, organism, analysis, stock, library) if the chado record has been deleted or the entry in the chado_[table] table has been removed.
- Parameters
-
$table | The name of the table that corresonds to the node type we want to clean up. |
$job_id | This should be the job id from the Tripal jobs system. This function will update the job status using the provided job ID. |
◆ chado_get_id_from_nid()
chado_get_id_from_nid |
( |
|
$table, |
|
|
|
$nid, |
|
|
|
$linking_table = NULL |
|
) |
| |
Get chado id for a node. E.g, if you want to get 'analysis_id' from the 'analysis' table for a synced 'chado_analysis' node, (the same for organisms and features): $analysis_id = chado_get_id_from_nid ('analysis', $node->nid) $organism_id = chado_get_id_from_nid ('organism', $node->nid) $feature_id = chado_get_id_from_nid ('feature', $node->nid)
- Parameters
-
$table | The chado table the chado record is from |
$nid | The value of the primary key of node |
$linking_table | The Drupal table linking the chado record to it's node. This field is optional and defaults to chado_$table |
- Returns
- The chado id of the associated chado record
◆ chado_get_nid_from_id()
chado_get_nid_from_id |
( |
|
$table, |
|
|
|
$id, |
|
|
|
$linking_table = NULL |
|
) |
| |
Get node id for a chado feature/organism/analysis. E.g, if you want to get the node id for an analysis, use: $nid = chado_get_nid_from_id ('analysis', $analysis_id) Likewise, $nid = chado_get_nid_from_id ('organism', $organism_id) $nid = chado_get_nid_from_id ('feature', $feature_id)
- Parameters
-
$table | The chado table the id is from |
$id | The value of the primary key from the $table chado table (ie: feature_id) |
$linking_table | The Drupal table linking the chado record to it's node. This field is optional and defaults to chado_$table |
- Returns
- The nid of the associated node
◆ chado_get_node_title()
chado_get_node_title |
( |
|
$node | ) |
|
◆ chado_get_node_url()
chado_get_node_url |
( |
|
$node | ) |
|
◆ chado_get_token_value()
chado_get_token_value |
( |
|
$token_info, |
|
|
|
$node, |
|
|
|
$options = [] |
|
) |
| |
Retrieve the value of the token from the node based on the $token_info['location']
- Parameters
-
$token_info | An array of information about the token including: -table: the name of the chado table -field: the name of the field in the above table -token: the token string (ie: [stock.stock_id]) -description: a very short description of the token (displayed when tokens are listed) -location: the location of the value in a chado node variable with each level separated by an arrow (>) symbol. For example, the location for $node->feature->type_id->name is feature>type_id>name |
$node | The node to get the value of the token |
- Returns
- The value of the token
◆ chado_node_add_token_format()
chado_node_add_token_format |
( |
|
$application, |
|
|
|
$content_type, |
|
|
|
$format, |
|
|
|
$tokens |
|
) |
| |
◆ chado_node_generate_tokens()
chado_node_generate_tokens |
( |
|
$base_table, |
|
|
|
$token_prefix = FALSE , |
|
|
|
$location_prefix = FALSE |
|
) |
| |
Generate tokens for a particular base table
- Parameters
-
$base_table | The name of the chado table you would like to generate tokens for |
$token_prefix | RECURSIVE ARG: Used to determine the generic token based on previous interations. For example, when adding cvterm fields to a feature token, the token_prefix is "feature.type_id" so that resulting tokens can be "feature.type_id>cvterm.*" (ie: [feature.type_id>cvterm.name] ) |
$location_prefix | RECURSIVE ARG: Used to keep track of the location of the value based on previous interations. For example, when adding cvterm fields to a feature token, the location_prefix is "feature > type_id" so that resulting tokens can be "feature > type_id > *" (ie: feature > type_id > name) |
- Returns
- An array of available tokens where the key is the table.field and the value is an array with the following keys: -table: the name of the chado table -field: the name of the field in the above table -token: the token string (ie: [stock.stock_id]) -description: a very short description of the token (displayed when tokens are listed) -location: the location of the value in a chado node variable with each level separated by an arrow (->) symbol. For example, the location for $node->feature->type_id->name is feature>type_id>name
◆ chado_node_get_base_table()
chado_node_get_base_table |
( |
|
$content_type, |
|
|
|
$module = FALSE |
|
) |
| |
Determine the chado base table for a given content type
- Parameters
-
$content_type | The machine name of the content type (node type) you want to determine the base chado table of |
$module | (Optional) The machine-name of the module implementing the content type |
- Returns
- The name of the chado base table for the specified content type
◆ chado_node_get_legacy_title_default()
chado_node_get_legacy_title_default |
( |
|
$content_type | ) |
|
Handles legacy title options
Features & Stocks already had custom functionality to handle title setting before this API was created. That has since been removed but but to remain backwards compatible this function checks for those old settings and translates them into new defaults.
◆ chado_node_get_legacy_url_default()
chado_node_get_legacy_url_default |
( |
|
$content_type | ) |
|
Handles legacy URL options
Features, Projects & Stocks already had custom functionality to handle URL setting before this API was created. That has since been removed but to remain backwards compatible this function checks for those old settings and translates them into new defaults.
◆ chado_node_get_title_format()
chado_node_get_title_format |
( |
|
$content_type, |
|
|
& |
$tokens, |
|
|
|
$base_table = NULL |
|
) |
| |
Get the title format for a specific content type
If the title format has not yet been set then the following will be done 1) Check to see if there is a legacy title format set (features & stocks) 2) Check if there is a defined default for this content type 3) Create a format using any name fields and the unique constraint for the base table associated with this content type
Define a default for a specific content type by implementing a function of the name [content type]_chado_node_default_title_format() that returns a string describing the default format.
- Parameters
-
$content_type | The name of the content (node) type you are interested in (ie: chado_feature) |
$tokens | An array, passed by reference that is filled to include the tokens for this node type. Each token is an array with the following keys: -table: the name of the chado table -field: the name of the field in the above table -token: the token string (ie: [stock.stock_id]) -description: a very short description of the token (displayed when tokens are listed) -location: the location of the value in a chado node variable with each level separated by an arrow (->) symbol. For example, the location for $node->feature->type_id->name is feature>type_id>name |
- Returns
- A string containing tokens describing the default format for the title of nodes of the specified content type.
◆ chado_node_get_token_format()
chado_node_get_token_format |
( |
|
$application, |
|
|
|
$content_type, |
|
|
|
$options = [] |
|
) |
| |
Get the format for the given application of a given content type (ie: the feature title)
- Parameters
-
$application | What the format is to be applied to. For example 'title' for generating node titles and 'path' for generating node paths |
$content_type | The name of the content type this format applies to (ie: $node->type) |
$options | An array of any of the following options:
- return_record: if TRUE this will return the entire record rather than just the format string
|
- Returns
- A string specifying the format
◆ chado_node_get_unique_constraint_format()
chado_node_get_unique_constraint_format |
( |
|
$base_table, |
|
|
|
$format_type = 'title' |
|
) |
| |
Generate the unique constraint for a given base table using the Chado Schema API definition
- Parameters
-
$base_table | The base table to generate the unique constraint format for |
$format_type | The type of format to return. This should be one of 'title' or 'url'. |
- Returns
- A format string including tokens describing the unique constraint including all name fields
◆ chado_node_get_url_format()
chado_node_get_url_format |
( |
|
$content_type, |
|
|
& |
$tokens, |
|
|
|
$base_table = NULL |
|
) |
| |
Get the url format for a specific content type
If the url format has not yet been set then the following will be done 1) Check to see if there is a legacy url format set (features & stocks) 2) Check if there is a defined default for this content type 3) Create a format using any name fields and the unique constraint for the base table associated with this content type
Define a default for a specific content type by implementing a function of the name [content type]_chado_node_default_url_format() that returns a string describing the default format.
- Parameters
-
$content_type | The name of the content (node) type you are interested in (ie: chado_feature) |
$tokens | An array, passed by reference that is filled to include the tokens for this node type. Each token is an array with the following keys: -table: the name of the chado table -field: the name of the field in the above table -token: the token string (ie: [stock.stock_id]) -description: a very short description of the token (displayed when tokens are listed) -location: the location of the value in a chado node variable with each level separated by an arrow (->) symbol. For example, the location for $node->feature->type_id->name is feature>type_id>name |
- Returns
- A string containing tokens describing the default format for the url of nodes of the specified content type.
◆ chado_node_sync_form()
chado_node_sync_form |
( |
|
$form, |
|
|
& |
$form_state |
|
) |
| |
◆ chado_node_sync_records()
chado_node_sync_records |
( |
|
$base_table, |
|
|
|
$max_sync = FALSE , |
|
|
|
$organism_id = FALSE , |
|
|
|
$types = [] , |
|
|
|
$ids = [] , |
|
|
|
$linking_table = FALSE , |
|
|
|
$node_type = FALSE , |
|
|
|
$job_id = NULL |
|
) |
| |
Generic function for syncing records in Chado with Drupal nodes.
- Parameters
-
$base_table | The name of the Chado table containing the record that should be synced |
$max_sync | Optional: A numeric value to indicate the maximum number of records to sync. |
$organism_id | Optional: Limit the list of records to be synced to only those that are associated with this organism_id. If the record is not associated with an organism then this field is not needed. |
$types | Optional: Limit the list of records to be synced to only those that match the types listed in this array. |
$ids | Optional: Limit the list of records to bye synced to only those whose primary key value matches the ID provided in this array. |
$linking_table | Optional: Tripal maintains "linking" tables in the Drupal schema to link Drupal nodes with Chado records. By default these tables are named as 'chado_' . $base_table. But if for some reason the linking table is not named in this way then it can be provided by this argument. |
$node_type | Optional: Tripal maintains "linking" tables in the Drupal schema to link Drupal nodes with Chado records. By default, Tripal expects that the node_type and linking table are named the same. However, if this is not the case, you can provide the node type name here. |
$job_id | Optional. Used by the Trpial Jobs system when running this function as a job. It is not needed othewise. |
◆ chado_retrieve_node_form_dbxrefs()
chado_retrieve_node_form_dbxrefs |
( |
|
$node | ) |
|
This function is used in a hook_insert, hook_update for a node form when the additional_dbxrefs form has been added to the form. It retrieves all of the dbxrefs and returns them in an array of the format:
$dbxefs[<db_id>][<version>][<dbxref_id>] = <accession>
This array can then be used for inserting or updating dbxrefs using the API call tripal_hook_insert_dbxref()
- Parameters
-
- Returns
- A dbxref array
◆ chado_retrieve_node_form_properties()
chado_retrieve_node_form_properties |
( |
|
$node | ) |
|
This function is used in a hook_insert, hook_update for a node form when the chado node properties form has been added to the form. It retrieves all of the properties and returns them in an array of the format:
$dbxefs[<type_id>][<rank>] =
This array can then be used for inserting or updating properties
- Parameters
-
- Returns
- A property array
◆ chado_retrieve_node_form_relationships()
chado_retrieve_node_form_relationships |
( |
|
$node | ) |
|
This function is used in a hook_insert, hook_update for a node form when the relationships form has been added to the form. It retrieves all of the relationships and returns them in an array of the format:
$relationships[<type_id>][<rank>] = array( 'subject_id' => <subject_id>, 'object_id' => <object_id>, );
This array can then be used for inserting or updating relationships manually
- Parameters
-
- Returns
- A relationship array
◆ chado_set_node_url()
chado_set_node_url |
( |
|
$node | ) |
|
Set the URL for a given node.
Note: This makes the old URL completely invalid which breaks bookmarks. Furthermore, if someone attempts to go to an old URL they will get a white screen PDO error which is not very user friendly ;-)
- Todo:
- handle re-directing for old URLs or at least ensure a page not found error is displayed.
- Parameters
-
$node | The node to set the URL for. The node object must have at a minimum the 'nid' and 'type' properties, as well as the chado object (e.g. 'organism' for chado_organism node type, and 'feature' for chado_feature node type, etc.). |
- Returns
- The URL alias that was set.
◆ chado_update_existing_node_urls()
chado_update_existing_node_urls |
( |
|
$content_type, |
|
|
|
$job_id = 0 |
|
) |
| |
Tripal Job for updating all node URLs for a particular node type.
- Parameters
-
$content_type | The machine name of the node type to update URLs for. |
$job_id | The ID of the tripal job calling this function. |
◆ chado_update_node_form_dbxrefs()
chado_update_node_form_dbxrefs |
( |
|
$node, |
|
|
|
$details, |
|
|
|
$retrieved_dbxrefs = FALSE |
|
) |
| |
This function is used in hook_insert or hook_update and handles inserting of any new dbxrefs and creation of links between those dbxrefs and node content
- Parameters
-
$node | The node passed into hook_insert & hook_update |
$details |
- linking_table: the name of the _dbxref linking table (ie: feature_dbxref)
- foreignkey_name: the name of the foreign key used to link to the node content (ie: feature_id)
- foreignkey_value: the value of the foreign key (ie: 445, if there exists a feature where feature_id=445)
|
$retrieved_dbxrefs | An array of databa references from chado_retrieve_node_form_dbxrefs($node). This can be used if you need special handling for some of the database references |
◆ chado_update_node_form_properties()
chado_update_node_form_properties |
( |
|
$node, |
|
|
|
$details, |
|
|
|
$retrieved_properties = FALSE |
|
) |
| |
This function is used in hook_insert or hook_update and handles inserting of any new properties
- Parameters
-
$node | The node passed into hook_insert & hook_update |
$details |
- property_table: the name of the _property linking table (ie: feature_property)
- base_table: the name of the base table (ie: feature)
- foreignkey_name: the name of the foreign key used to link to the node content (ie: feature_id)
- foreignkey_value: the value of the foreign key (ie: 445, if there exists a feature where feature_id=445)
|
$retrieved_properties | An array of properties from chado_retrieve_node_form_properties($node). This can be used if you need special handling for some of the properties (See FeatureMap chado_featuremap_insert for an example) |
◆ chado_update_node_form_relationships()
chado_update_node_form_relationships |
( |
|
$node, |
|
|
|
$details, |
|
|
|
$retrieved_relationships = FALSE |
|
) |
| |
This function is used in hook_insert or hook_update and handles inserting of relationships between the current nodetype and other memebers of the same nodetype
- Parameters
-
$node | The node passed into hook_insert & hook_update |
$details |
- relationship_table: the name of the _relationship linking table (ie: feature_relationship)
- foreignkey_value: the value of the foreign key (ie: 445, if there exists a feature where feature_id=445)
|
$retrieved_relationships | An array of relationships from chado_retrieve_node_form_relationships($node). This can be used if you need special handling for some of the relationships. |
◆ hook_chado_node_sync_create_new_node()
hook_chado_node_sync_create_new_node |
( |
|
$new_node, |
|
|
|
$record |
|
) |
| |
Create New Node
Note: For your own module, replace hook in the function name with the machine-name of your chado node type (ie: chado_feature).
- Parameters
-
$new_node | : a basic new node object |
$record | : the record object from chado specifying the biological data for this node |
- Returns
- A node object containing all the fields necessary to create a new node during sync
◆ hook_chado_node_sync_form()
hook_chado_node_sync_form |
( |
|
$form, |
|
|
& |
$form_state |
|
) |
| |
Alter the Chado node sync form.
This might be necessary if you need additional filtering options for choosing which chado records to sync or even if you just want to further customize the help text provided by the form.
Note: For your own module, replace hook in the function name with the machine-name of your chado node type (ie: chado_feature).
◆ hook_chado_node_sync_form_submit()
hook_chado_node_sync_form_submit |
( |
|
$form, |
|
|
|
$form_state |
|
) |
| |
Bypass chado node api sync form submit.
Allows you to use this function as your own submit.
This might be necessary if you want to add additional arguments to the tripal job or to call your own sync'ing function if the generic chado_node_sync_records() is not sufficient.
Note: For your own module, replace hook in the function name with the machine-name of your chado node type (ie: chado_feature).
◆ hook_chado_node_sync_select_query()
hook_chado_node_sync_select_query |
( |
|
$query | ) |
|
Alter the query that retrieves records to be sync'd (optional)
This might be necessary if you need fields from other chado tables to create your node or if your chado node type only supports a subset of a given table (ie: a germplasm node type might only support node creation for cerain types of stock records in which case you would need to filter the results to only those types).
Note: For your own module, replace hook in the function name with the machine-name of your chado node type (ie: chado_feature).
- Parameters
-
$query | An array containing the following: 'select': An array of select clauses 'joins: An array of joins (ie: a single join could be 'LEFT JOIN {chadotable} alias ON base.id=alias.id') 'where_clauses: An array of where clauses which will all be AND'ed together. Use :placeholders for values. 'where_args: An associative array of arguments to be subbed in to the where clause where the |