function tripal_pub_remote_alter_form_AGL

2.x tripal_pub.AGL.inc tripal_pub_remote_alter_form_AGL($form, $form_state, $num_criteria = 1)
3.x tripal_chado.pub_importer_AGL.inc tripal_pub_remote_alter_form_AGL($form, $form_state, $num_criteria = 1)
1.x AGL.inc tripal_pub_remote_alter_form_AGL($form, $form_state)

A hook for altering the publication importer form. It Changes the 'Days' element to 'Year' and removes the 'Journal Name' filter.

Parameters

$form: The Drupal form array

$form_state: The form state array

$num_criteria: The number of criteria the user currently has added to the form

Return value

The form (drupal form api)

File

tripal_chado/includes/loaders/tripal_chado.pub_importer_AGL.inc, line 28
This file provides support for importing and parsing of results from the USDA National Agricultural Library (AGL) database. The functions here are used by both the publication importer setup form and the publication importer. The USDA AGL database…

Code

function tripal_pub_remote_alter_form_AGL($form, $form_state, $num_criteria = 1) {

  // So far we haven't been able to get AGL to filter results to only
  // include pubs by the XX number days in the past.  So, we will
  // change the 'days' element to be the year to query
  $form['themed_element']['days']['#title'] = t('Year');
  $form['themed_element']['days']['#description'] = t('Please enter a year to limit records by the year they were published, created or modified in the database.');

  // The Journal Name filter doesn't seem to work, so remove it
  for ($i = 1; $i <= $num_criteria; $i++) {
    unset($form['themed_element']['criteria'][$i]["scope-$i"]['#options']['journal']);
  }
  return $form;
}