'planteome_form_alter_node_add_modal_callback', 'page arguments' => array(1,3), 'access arguments' => array('access content'), 'theme callback' => 'ajax_base_page_theme', ); $items['modal/node/%/edit/%ctools_js/%'] = array( 'page callback' => 'planteome_form_alter_page_edit', 'page arguments' => array(2, 4,5), 'access callback' => 'node_access', 'access arguments' => array('update', 2), 'theme callback' => 'ajax_base_page_theme', ); return $items; } function planteome_form_alter_form_node_form_alter(&$form, $form_state) { // echo'
';var_dump($form['options']);exit;
}
/*
* Implementation of hook_form_alter()
*/
function planteome_form_alter_form_alter(&$form, &$form_state, $form_id){
// drupal_set_message($form_id);
global $user;
if(isset($form_state['#node'])){
$node = $form_state['#node'];
}
else{
$node = '';
}
// if($form_id == 'edit_options'){
// exit();
// }
// echo'';var_dump($node);exit;
if ($form_id == 'gene_node_form' || $form_id == 'annotation_node_form'){
drupal_add_js(base_path().drupal_get_path('module','planteome_form_alter').'/js/form_alter.js','file');
ctools_include('ajax');
ctools_include('modal');
ctools_modal_add_js();
foreach($form['field_publication'][LANGUAGE_NONE] as $key => $value) {
if (!is_numeric($key)) continue;
$form['field_publication'][LANGUAGE_NONE][$key]['operation_type']= array(
'#type' => 'radios',
'#weight' => -1,
'#title' => t(''),
'#options' => array(t('Select Publication from Database'), t('Add New Publication to Database')),
'#default_value' => 0,
'#prefix' => "",
'#suffix' => '',
);
$biblio_ciation = '';
if (isset($form_state['values']['field_publication'][LANGUAGE_NONE][$key]['target_id']) && !empty($form_state['values']['field_publication'][LANGUAGE_NONE][$key]['target_id'])) {
$node_bilio = node_load($form_state['values']['field_publication'][LANGUAGE_NONE][$key]['target_id']);
$node_view = node_view($node_bilio,'teaser');
$biblio_ciation = drupal_render($node_view);
}
$form['field_publication'][LANGUAGE_NONE][$key]['target_id']['#weight'] = 1;
$form['field_publication'][LANGUAGE_NONE][$key]['target_id']['#prefix'] = "";
$form['field_publication'][LANGUAGE_NONE][$key]['target_id']['#suffix'] = "".$biblio_ciation." ";
if(!isset($form['#node']->nid) || isset($form['#node']->is_new)){
$output = ctools_modal_text_button(t('Add Biblio'), 'biblio/nojs/add/'.$key, 'Add Biblio','btn-success btn');
$form['field_publication'][LANGUAGE_NONE][$key]['biblio_link'] = array(
'#type' => 'item',
'#markup' => $output,
'#weight' => 21,
'#prefix' => '',
);
} else {
if(isset($form['#node']->field_publication[LANGUAGE_NONE][$key]['target_id']) && isset($form_state['build_info']['args'][0]->field_publication[LANGUAGE_NONE][$key]['target_id'])){
//echo ""; print_r($form_state['build_info']['args'][0]->field_publication[LANGUAGE_NONE][$key]['target_id']); exit();
$form['field_publication'][LANGUAGE_NONE][$key]['operation_type']['#options'] = array(t('Add new publication'), t('Edit publication'));
$entity_nid = $form['#node']->field_publication[LANGUAGE_NONE][$key]['target_id'];
$node_bilio = node_load($entity_nid);
$node_view = node_view($node_bilio,'teaser');
$rendered_node = "".drupal_render($node_view)."";
$form['field_publication'][LANGUAGE_NONE][$key]['target_id']['#suffix'] = "".$rendered_node." ";
$output = ctools_modal_text_button(t('Edit Biblio content'), 'modal/node/'.$entity_nid.'/edit/nojs/'.$key, 'Edit Biblio content','btn-success btn');
$form['field_publication'][LANGUAGE_NONE][$key]['biblio_link'] = array(
'#type' => 'item',
'#markup' => $output,
'#weight' => 21,
'#prefix' => '',
);
} else {
$output = ctools_modal_text_button(t('Add Biblio'), 'biblio/nojs/add/'.$key, 'Add Biblio','btn-success btn');
$form['field_publication'][LANGUAGE_NONE][$key]['biblio_link'] = array(
'#type' => 'item',
'#markup' => $output,
'#weight' => 21,
'#prefix' => '',
);
}
}
$form['field_publication'][LANGUAGE_NONE][$key]['target_id']['#ajax'] = array(
'callback' => 'publications_put_full_citation',
'wrapper' => 'biblio-full_citation-'.$key,
'method' => 'replace',
'effect' => 'fade',
);
}
$form['field_publication'][LANGUAGE_NONE]['add_more']['#value'] = t('Add another Publication');
// echo'';var_dump($form);exit;
if( isset($node->nid) && in_array('Contributors', $user->roles) ){
$form['field_ref_species']['und']['0']['value']['#attributes']['disabled'] = TRUE;
$form['field_data_source']['und']['0']['value']['#attributes']['disabled'] = TRUE;
foreach($form['field_publication']['und'] as $key => $v){
if(!is_numeric($key)){
continue;
}
if(isset($form['field_publication']['und'][$key]['target_id']['#default_value']) && !empty($form['field_publication']['und'][$key]['target_id']['#default_value'])){
$form['field_publication']['und'][$key]['target_id']['#attributes']['disabled']=TRUE;
unset($form['field_publication']['und'][$key]['remove_button']);
}
}
}
$form['options']['help'] = [
'#markup' => 'Moderation Notes:
- Add a brief description of the changes made.
Moderation State:
- Draft - save the content without submitting it for review, used to save work (privately) to be finished later.
- Needs Review - save the content and submit it for review, shares work with Curators who will go through the moderation process.
- Published - save the content as ready to be displayed on the site (Contributors must go through the moderation workflow, this option is only shown to Curators and above)
',
/*'#type' => 'textarea',
'#title' => 'text',
'#description' => 'test desc',*/
];
// echo'';var_dump($form['options']);exit;
}
if($form_id == 'annotation_node_form'){
// annotation form setup
$form['field_ontology_id'][LANGUAGE_NONE][0]['value']['#autocomplete_path'] = 'autocomplete/ontology_term_extended';
$form['#validate'][] = 'ontology_qa_validate';
$form['field_date']['#access'] = FALSE;
$form['field_with_or_from'][LANGUAGE_NONE]['add_more']['#value'] = t('Add another Data Source');
$form['field_db_reference'][LANGUAGE_NONE]['add_more']['#value'] = t('Add another DB reference');
$form['field_ontology_id'][LANGUAGE_NONE][0]['#suffix'] = "";
$form['field_ontology_id'][LANGUAGE_NONE][0]['value']['#ajax'] = array(
'callback' => 'ontology_field_get_info',
'wrapper' => 'ontology-descr',
'method' => 'replace',
'effect' => 'fade',
);
$form['field_assigned_by']['#disabled'] = TRUE;
$accession_int = format_annotation_accession_alt_1();
$form['title']['#default_value'] = 'A'.$accession_int;
$form['title']['#access'] = FALSE;
$form['field_data_source']['und'][0]['field_object_id']['und'][0]['value']['#default_value'] = 'A'.$accession_int;
$form['field_data_source']['#disabled'] = TRUE;
$form['actions']['submit']['#submit'][] = 'format_annotation_accession_alt_2';
// echo'';var_dump($form);exit;
// annotation form change for contributors
if(in_array('Contributors', array_values($user->roles))){
$form['field_db_reference']['#access'] = FALSE;
}
//annotation form for cloned annotation handled in node_clone module
//annotation form change for new annotation from gene page
$q_params = drupal_get_query_parameters();
// echo'';var_dump(current_path());exit;
if(count($q_params) && isset($q_params['gene'])) {
$gene = node_load($q_params['gene']);
$form['field_gene']['und'][0]['target_id']['#default_value'] = $gene->title.' ('.$gene->nid.')';
$form['field_gene']['#attributes'] = array('readonly' =>'readonly');
$form['field_gene']['#disabled'] = TRUE;
$species = node_load($gene->field_ref_species['und'][0]['target_id']);
$form['field_ref_species']['und'][0]['target_id']['#default_value'] = $species->title.' ('.$species->nid.')';
$form['field_ref_species']['#disabled'] = TRUE;
$form['field_ref_species']['#attributes'] = array('readonly' =>'readonly');
}
if(isset($node->nid)) {
$form['field_gene']['#attributes'] = array('readonly' =>'readonly');
$form['field_ref_species']['#attributes'] = array('readonly' =>'readonly');
}
$form['optional_divider'] = [
'#markup' => '
'.variable_get('optional_divider_text').'
',
'#weight' => 9,
];
}
if($form_id == 'gene_node_form'){
if(!isset($form['nid']['#value'])) {
$accession_int = format_gene_accession_alt_1();
// echo'';var_dump($form['field_data_source']);exit;
$form['field_accession']['und'][0]['value']['#default_value'] = 'P'.$accession_int;//.$accession_int;
$form['field_data_source']['und'][0]['field_object_id']['und'][0]['value']['#default_value'] = 'P'.$accession_int;
$form['actions']['submit']['#submit'][] = 'format_gene_accession_alt_2';
$form['field_data_source']['#disabled'] = TRUE;
}
if(isset($form['nid']['#value'])){
$n = node_load($form['nid']['#value']);
$form['text'] = [
// '#markup' => 'You are currently editing a gene. To view the original content, follow this link: '.drupal_get_path_alias('node/'.$node->nid).'
',
'#markup' => ''.t('Note: ').''.t('You are currently editing a gene. To view the original content, follow this link: ').l(t($n->title), 'node/'.$n->nid).'
',
];
// drupal_set_message('You are currently editing a gene. To view the original content, follow this link: '.drupal_get_path_alias('node/'.$node->nid));
}
// echo'';var_dump($form['body']['und'][0]['#rows']);exit;
$form['body']['und'][0]['#rows'] = 10;
$form['field_gene_ontology_terms']['#disabled'] = TRUE;
$form['field_accession']['und']['0']['value']['#attributes']['disabled'] = TRUE;
if (isset($form['nid']['#value']) && in_array('Contributors', $user->roles)){
$node = node_load($form['nid']['#value']);
if($node->uid != $user->uid){
$form['body'][LANGUAGE_NONE][0]['summary']['#access'] = FALSE;
$form['field_gene_symbol']['und'][0]['value']['#attributes']['disabled'] = TRUE;
$form['field_gene_name']['und'][0]['value']['#attributes']['disabled'] = TRUE;
$form['field_gene_id']['und'][0]['value']['#attributes']['disabled'] = TRUE;
$form['field_chromosome_no']['und'][0]['value']['#attributes']['disabled'] = TRUE;
$form['field_chromosome_start']['und'][0]['value']['#attributes']['disabled'] = TRUE;
$form['field_chromosome_stop']['und'][0]['value']['#attributes']['disabled'] = TRUE;
$form['field_ref_species']['und'][0]['target_id']['#attributes']['disabled'] = TRUE;
$form['field_gene_type']['#disabled'] = TRUE;
$form['field_data_source']['#disabled'] = TRUE;
// $form['field_gene_type']['und']['0']['value']['#attributes']['disabled'] = TRUE;
foreach($form['field_synonyms']['und'] as $key => $v){
if(!is_numeric($key)){
continue;
}
if(isset($form['field_synonyms']['und'][$key]['value']['#default_value']) && !empty($form['field_synonyms']['und'][$key]['value']['#default_value'])){
$form['field_synonyms']['und'][$key]['value']['#attributes']['disabled']=TRUE;
unset($form['field_synonyms']['und'][$key]['remove_button']);
}
}
}
}
if (isset($node->nid) && !in_array('administrator', array_values($user->roles))) {
$node = node_load($form['nid']['#value']);
if($node->uid != $user->uid){
// echo'';var_dump($form);exit;
//shoud hide title, accession, gene ontology terms
$form['title']['#type'] = 'value';
// $form['field_gene_ontology_terms']['#access'] = FALSE;
// $form['field_gene_ontology_terms']['#type'] = 'value';
$form['field_gene_ontology_terms']['#access'] = FALSE;
$form['field_accession']['#access'] = FALSE;
$form['field_ref_species']['#disabled'] = TRUE;
$form['field_gene_type']['#disabled'] = TRUE;
$form['field_chromosome_no']['#disabled'] = TRUE;
$form['field_chromosome_start']['#disabled'] = TRUE;
$form['field_chromosome_stop']['#disabled'] = TRUE;
$form['field_data_source']['#disabled'] = TRUE;
// $form['field_accession']['#access'] = FALSE;
// echo'';var_dump($form['field_gene_ontology_terms']);exit;
}
}
if(isset($node->nid)){
$form['immutable'] = array(
'#type' => 'textarea', //you can find a list of available types in the form api
'#title' => 'Current Description',
'#size' => 60,
'#weight' => -1,
'#attributes' => array('disabled' => 'disabled'),
'#default_value' => $form['#node']->body[LANGUAGE_NONE][0]['value'],
);
}
$form['field_synonyms'][LANGUAGE_NONE]['add_more']['#value'] = t('Add another Synonym');
}
if ($form_id == 'user_profile_form' && !in_array('administrator', $user->roles)){
$form['field_curation_species']['#access'] = false;
}
if($form_id == 'views_exposed_form' && $form_state['view']->name == 'workbench_moderation'){
if(isset($form['type']['#options'])){
$form['type']['#options'] = array(
'All' => '- Any -',
'annotation' => 'Annotation',
'gene' => 'Gene',
);
}
}
if($form_id == 'biblio_node_form'){
$form['#prefix'] = "If your source does not have a PMID or DOI, and is not in BibTex format, please select a source type from the dropdown below and fill out the resulting form. If you select a type and the form does not automatically redirect you, click next.";
}
if($form_id == 'planteom_mycontent_filter_form' || $form_id == 'planteom_needs_review_filter_form'){
$form['form_build_id']['#access'] = FALSE;
$form['form_token']['#access'] = FALSE;
$form['form_id']['#access'] = FALSE;
}
return $form;
}
function planteome_form_alter_page_edit($nid, $js, $key) {
if (!$js) {
return drupal_goto('node/'.$nid.'/edit/');
}
ctools_include('node.pages', 'node', '');
ctools_include('modal');
ctools_include('ajax');
$node = node_load($nid);
$form_state = array(
'title' => t('Add my conten type'),
'ajax' => TRUE,
);
$form_state['build_info']['args'] = array($node);
// change this to your type node form
$output = ctools_modal_form_wrapper('biblio_node_form', $form_state);
if (!empty($form_state['executed'])) {
$output = array();
// Close the modal
$output[] = ctools_modal_command_dismiss();
$messages = drupal_get_messages('status', TRUE);
$msg_opt = "\n";
$output[] = ajax_command_replace('#biblio-message-'.$key, $msg_opt);
// I use this method a lot on pages that have views, so what I do is get the latest view content
// with the latest node and replace the current view. magic!
/*
$html = views_embed_view('my_view', 'my_display';
$output[] = ajax_command_html('.view-display-id-my_display', $html);
*/
if(isset($form_state['values']['nid'])){
$nid = $form_state['values']['nid'];
$node_bilio = node_load($nid);
$node_view = node_view($node_bilio,'teaser');
$rendered_node = "".drupal_render($node_view)."";
$output[] = ajax_command_replace('#biblio-full_citation-'.$key,$rendered_node);
}
}
print ajax_render($output);
exit;
}
function planteome_form_alter_node_add_modal_callback($js=FALSE, $key){
global $user;
if (!$js) return "Javascript required";
ctools_include('node.pages', 'node', '');
ctools_include('modal');
ctools_include('ajax');
// Create a blank node object here. You can also set values for your custom fields here as well.
$node = (object) array(
'uid' => $user->uid,
'name' => (isset($user->name) ? $user->name : ''),
'type' => 'biblio',
'language' => LANGUAGE_NONE,
);
$form_state = array(
'title' => t('Add my publication'),
'ajax' => TRUE,
);
$form_state['build_info']['args'] = array($node);
// change this to your type node form
$output = ctools_modal_form_wrapper('biblio_node_form', $form_state);
// This means the form has been exectued
if (!empty($form_state['executed'])) {
if(isset($form_state['values']['nid']) && !empty($form_state['values']['nid'])){
// Close the modal
// $output[] = ctools_modal_command_dismiss();
$output = array(ctools_modal_command_dismiss());
$nid = $form_state['values']['nid'];
$title = $form_state['values']['title'];
$inputValue = $title." (".$nid.")";
$node_bilio = node_load($nid);
$node_view = node_view($node_bilio,'teaser');
$rendered_node = "".drupal_render($node_view)."";
$output[] = ajax_command_replace('#biblio-full_citation-'.$key,$rendered_node);
$link = ctools_modal_text_button(t('Edit Content'), 'modal/node/'.$nid.'/edit/nojs/'.$key, 'test_biblio');
$output[] = ajax_command_replace('#biblio-link-'.$key.' a.ctools-use-modal', $link);
$messages = drupal_get_messages('status', TRUE);
$msg_opt = "\n";
$output[] = ajax_command_replace('#biblio-message-'.$key, $msg_opt);
$output[] = ajax_command_invoke('#operation-target-'.$key.' input.form-text', 'val', array($inputValue));
}else{
// $output = array();
$output[] = ajax_command_html('array()');
}
// I use this method a lot on pages that have views, so what I do is get the latest view content
// with the latest node and replace the current view. magic!
/*
$html = views_embed_view('my_view', 'my_display';
$output[] = ajax_command_html('.view-display-id-my_display', $html);
*/
}
//$output.= theme('status_messages', array('display' => 'error'));
print ajax_render($output);
exit;
}
function planteome_form_alter_views_query_alter(&$view, &$query){
if($view->name == 'workbench_moderation' && $view->current_display == 'page_3'){
global $user;
// this should possibly be written more correctly?
//$query->where[2]['conditions'][0]['value'][':node_uid_revision'][0] = $user->uid;
// echo'';var_dump($user);exit;
}
}
function planteome_form_alter_form_comment_form_alter(&$form, &$form_state, $form_id, &$name, $account) {
global $user;
//$label = t('New label');
$account = user_load($user->uid);
$first_name= $account->field_firstname['und'][0]['value'];
$last_name= $account->field_lastname['und'][0]['value'];
//echo ""; print_r($form); exit();
if (isset($form['author']['_author'])) {
$form['author']['_author']['#markup'] = $first_name ." " . $last_name;
}
$form['subject']['#access'] = FALSE;
//$form['body_field']['und'][0]['format']['#attributes']['class'] = 'invisible';
// else {
// $form['author']['name']['#title'] = $label;
// }
}
function planteome_form_alter_translated_menu_link_alter(&$link) {
global $user;
// Hide the "User account" link for anonymous users.
if ($link['href'] == 'admin/workbench') {
$link['href'] = 'admin/workbench/my-published-content';
}
}
function planteome_form_alter_module_implements_alter(&$implementations, $hook) {
if ($hook == 'translated_menu_link_alter') {
$group = $implementations['planteome_form_alter'];
unset($implementations['planteome_form_alter']);
$implementations['planteome_form_alter'] = $group;
}
if (($hook == 'form_node_form_alter' || $hook == 'form_alter') && isset($implementations['planteome_form_alter'])) {
$group = $implementations['planteome_form_alter'];
unset($implementations['planteome_form_alter']);
$implementations['planteome_form_alter'] = $group;
}
}
//helper functions
function format_annotation_accession_alt_1(){
$results = db_select('annotation_accession', 'ann_acc')
->fields('ann_acc')
->execute()
->fetchAssoc();
$accession_int = $results['accession'];
$accession_number = (string)$accession_int;
$acc_len = strlen($accession_number);
for($acc_len;$acc_len < 12; $acc_len++){
$accession_number = '0'.$accession_number;
}
return $accession_number;
}
function format_annotation_accession_alt_2(){
$results = db_select('annotation_accession', 'ann_acc')
->fields('ann_acc')
->execute()
->fetchAssoc();
$accession_int = $results['accession'];
$accession_number = (string)$accession_int;
$acc_len = strlen($accession_number);
for($acc_len;$acc_len < 12; $acc_len++){
$accession_number = '0'.$accession_number;
}
$accession_int++;
$query = db_update('annotation_accession')
->fields(array(
'accession' => $accession_int))
->execute();
$results = db_select('annotation_accession', 'ann_acc')
->fields('ann_acc')
->execute()
->fetchAssoc();
}
function format_gene_accession_alt_1(){
$results = db_select('accession', 'acc')
->fields('acc')
->execute()
->fetchAssoc();
$accession_int = $results['accession'];
$accession_number = (string)$accession_int;
$acc_len = strlen($accession_number);
for($acc_len;$acc_len < 12; $acc_len++){
$accession_number = '0'.$accession_number;
}
return $accession_number;
}
function format_gene_accession_alt_2(){
$results = db_select('accession', 'acc')
->fields('acc')
->execute()
->fetchAssoc();
$accession_int = $results['accession'];
$accession_number = (string)$accession_int;
$acc_len = strlen($accession_number);
for($acc_len;$acc_len < 12; $acc_len++){
$accession_number = '0'.$accession_number;
}
$accession_int++;
$query = db_update('accession')
->fields(array(
'accession' => $accession_int))
->execute();
$results = db_select('accession', 'acc')
->fields('acc')
->execute()
->fetchAssoc();
}
function publications_put_full_citation($form,$form_states){
//echo ""; print_r($form_states['input']);exit;
$triggering_ele = $form_states['input']['_triggering_element_name'];
$key = explode('field_publication[und][', $triggering_ele);
$key = $key[1];
$key = explode('][target_id]', $key);
$key = $key[0];
$commands = array();
if(isset($form_states['values']['field_publication'][LANGUAGE_NONE][$key]['target_id']) && !empty($form_states['values']['field_publication'][LANGUAGE_NONE][$key]['target_id']) && is_numeric($key)){
$node_bilio = node_load($form_states['values']['field_publication'][LANGUAGE_NONE][$key]['target_id']);
$node_view = node_view($node_bilio,'teaser');
$rendered_node = "".drupal_render($node_view)."";
$commands[] = ajax_command_replace('#biblio-full_citation-'.$key,$rendered_node);
}
return array('#type' => 'ajax','#commands' => $commands);
}
function get_ontology_term_info_api($id_string){
$html_json = htmlspecialchars(curl_get_contents("http://browser.planteome.org/api/autocomplete/ontology?q=".url_encode_2($id_string)));
$tmp = html_entity_decode($html_json);
$json_obj = json_decode($tmp);
$output = $id_string;
if(is_object($json_obj) && count($json_obj->data)){
$output = $json_obj->data[0];
}
return $output;
}
function ontology_field_get_info($form,$form_state){
$ontoloty_term = $form_state['values']['field_ontology_id'][LANGUAGE_NONE][0]['value'];
$ontology_term_info = get_ontology_term_info_api($ontoloty_term);
// echo'';var_dump($ontology_term_info->source);exit;
$output = '';
if(!empty($ontoloty_term) && $ontology_term_info != $ontoloty_term){
$output .= "";
$output .= " ".$ontology_term_info->source."";
$output .= " ".$ontology_term_info->annotation_class_label."";
$output .= " ".$ontology_term_info->description."";
$output .= "";
}else{
$output .= "";
}
$commands = array();
$commands[] = ajax_command_replace('#ontology-descr',$output);
return array('#type' => 'ajax','#commands' => $commands);
}
function ontology_qa_validate($form, &$form_state){
$aspect_tid = $form['field_aspect']['und']['#value'];
$ontology_term = $form['field_ontology_id']['und'][0]['value']['#value'];
$html_json = htmlspecialchars(curl_get_contents("http://browser.planteome.org/api/autocomplete/ontology?q=".url_encode_2($ontology_term)));
$tmp = html_entity_decode($html_json);
$json_obj = json_decode($tmp);
// $output = $id_string;
if(is_object($json_obj) && count($json_obj->data)){
$data = $json_obj->data;
$data_obj = $data[0];
$data_source = $data_obj->source;
switch ($aspect_tid) {
case '609':
if($data_source != 'cellular_component'){
form_set_error('field_ontology_id', 'Ontology ID does not match Ontology Type');
}
break;
case '2327':
if($data_source != 'plant_trait_ontology'){
form_set_error('field_ontology_id', 'Ontology ID does not match Ontology Type');
}
break;
case '603':
if($data_source != 'biological_process'){
form_set_error('field_ontology_id', 'Ontology ID does not match Ontology Type');
}
break;
case '605':
if($data_source != 'molecular_function'){
form_set_error('field_ontology_id', 'Ontology ID does not match Ontology Type');
}
break;
case '614':
if($data_source != 'plant_anatomy'){
form_set_error('field_ontology_id', 'Ontology ID does not match Ontology Type');
}
break;
case '2328':
if($data_source != 'plant_environment_ontology'){
form_set_error('field_ontology_id', 'Ontology ID does not match Ontology Type');
}
break;
case '2329':
if($data_source != 'plant_structure_development_stage'){
form_set_error('field_ontology_id', 'Ontology ID does not match Ontology Type');
}
break;
default:
form_set_error('field_ontology_id', 'Ontology type does not match existing Ontology types.');
break;
}
}
}