|
| tripal_validate_bulk_loader_template ($val_type, &$options, &$errors, &$warnings=[]) |
|
| tripal_insert_bulk_loader_template ($options, &$errors, &$warnings) |
|
| tripal_is_bulk_loader_record_name_unique ($new_record_name, $template_id, $template_array=NULL, $current_priority=NULL) |
|
| tripal_delete_bulk_loader_record ($delete_priority, $template_array) |
|
| tripal_delete_bulk_loader_field ($priority, $delete_field_index, $template_array) |
|
All functions in this file provide an API to administrative management of bulk loader templates.
◆ tripal_delete_bulk_loader_field()
tripal_delete_bulk_loader_field |
( |
|
$priority, |
|
|
|
$delete_field_index, |
|
|
|
$template_array |
|
) |
| |
An API function to delete a field from a template array
- Parameters
-
$priority | The priority of the record containing the field |
$delete_field_index | The index of the field to be deleted |
$template_array | The array describing the template |
- Returns
- The modified template array
◆ tripal_delete_bulk_loader_record()
tripal_delete_bulk_loader_record |
( |
|
$delete_priority, |
|
|
|
$template_array |
|
) |
| |
An API function to delete a record from a template array
- Parameters
-
$delete_priority | The priority of the record to be deleted |
$template_array | The array describing the template |
- Returns
- The modified template array
◆ tripal_insert_bulk_loader_template()
tripal_insert_bulk_loader_template |
( |
|
$options, |
|
|
& |
$errors, |
|
|
& |
$warnings |
|
) |
| |
Inserts a bulk loader template record.
This function validates the options passed prior to insertion of the record.
- Parameters
-
$options | An array of key/value pairs containing the following keys: 'template_name': The name of the template. 'template_array': The JSON array representing the template. Optional: 'strict': If set then only JSON formatted templates are allowed. |
$errors | An empty array where validation error messages will be set. The keys of the array will be name of the field from the options array and the value is the error message. |
$warnings | An empty array where validation warning messagges will be set. The warnings should not stop an insert or an update but should be provided to the user as information by a drupal_set_message() if appropriate. The keys of the array will be name of the field from the options array and the value is the error message. |
- Returns
- TRUE for success and FALSE for failure.
◆ tripal_is_bulk_loader_record_name_unique()
tripal_is_bulk_loader_record_name_unique |
( |
|
$new_record_name, |
|
|
|
$template_id, |
|
|
|
$template_array = NULL , |
|
|
|
$current_priority = NULL |
|
) |
| |
Meant to be called from a form_validate function to ensure a newly added bulk loader record name is unique and not empty.
- Parameters
-
$new_record_name | The record name to check for uniqueness |
$template_id | The template_id of the template to add the record to |
$template_array | The array describing the template. Optional -will be loaded using template_id if not provided |
$current_priority | The priority of the already existing record -checks that the name only occurs on this particular record |
- Returns
- TRUE if the record name is not empty and not already in the template_array; FALSE otherwise
◆ tripal_validate_bulk_loader_template()
tripal_validate_bulk_loader_template |
( |
|
$val_type, |
|
|
& |
$options, |
|
|
& |
$errors, |
|
|
& |
$warnings = [] |
|
) |
| |
Validates an $options array for insert or update of a bulk loader record.
- Parameters
-
$val_type | The type of validation. Can be either 'insert' or 'update'. |
$options | An array of key/value pairs containing the following keys: template_name: The name of the template. template_array: The JSON array representing the template. Optional: strict: If set then only JSON formatted templates are allowed. |
$errors | An empty array where validation error messages will be set. The keys of the array will be name of the field from the options array and the value is the error message. |
$warnings | An empty array where validation warning messagges will be set. The warnings should not stop an insert or an update but should be provided to the user as information by a drupal_set_message() if appropriate. The keys of the array will be name of the field from the options array and the value is the error message. |
- Returns
- If validation fails then FALSE is returned. Any options that do not pass validation checks will be added in the $errors array with the key being the option and the value being the error message. If validation is successful then TRUE is returned.