modules/custom/pasta/pasta.module

Summary

Maintainability
Test Coverage
<?php
/**
 * Implements hook_form_alter().
 */
function pasta_form_eml_settings_form_alter(&$form, &$form_state) {
  $form['pasta'] = array(
    '#type' => 'fieldset',
    '#title' => t('PASTA API'),
  );

  $form['pasta']['eml_pasta_user'] = array(
    '#type' => 'textfield',
    '#title' => t('PASTA API user'),
    '#description' => t('This field supports tokens.'),
    '#default_value' => variable_get('eml_pasta_user', 'uid=[site:station-acronym],o=LTER,dc=ecoinformatics,dc=org:password'),
    '#required' => TRUE,
    '#element_validate' => array('token_element_validate'),
    '#attributes' => array('style' => 'width: 100%;'),
    '#maxlength' => 255,
  );
  $form['pasta']['eml_pasta_base_url'] = array(
    '#type' => 'textfield',
    '#title' => t('PASTA API URL'),
    '#default_value' => variable_get('eml_pasta_base_url', 'https://pasta.lternet.edu'),
    '#description' => t('This URL has been set for you when you selected <em>Development</em> or <em>Production</em> environment.'),
  );
  $form['pasta']['tokens'] = array(
    '#theme' => 'token_tree',
    '#dialog' => TRUE,
  );
}

/**
  * Implement hook_help()
  */
function pasta_help($path, $arg) {
  switch ($path) {
    case 'admin/help#pasta':
      return '<h3>' . t('About') . '</h3>' . '<p>' . t("The PASTA module provides an automated mechanism to participate
   in the PASTA services to store data and metadata objects. PASTA, or Provenance Aware System Tracking Architecture, is a
   service offered to LTER sites to store permanently data records.  Once this module is enabled, each time a dataset is published
   or updated, the PASTA module will try to send a copy to the PASTA-enabled repositories using the PASTA services, it does so
   by using the Drupal queue systems and the EML Web Service") . '<p>';
  }
}

// ----------------------------------------------------------------------------
// Cron queues
// ----------------------------------------------------------------------------

/**
 * Implements hook_cron_queue_info().
 */
function pasta_cron_queue_info() {
  $info['PastaValidationQueue'] = array(
    'worker callback' => 'pasta_validation_queue_process',
    'time' => 20,
  );
  $info['PastaSubmissionQueue'] = array(
    'worker callback' => 'pasta_submission_queue_process',
    'time' => 30,
  );

  return $info;
}

/**
 * Implements callback_cron_queue_info_worker().
 */
function pasta_validation_queue_process($data) {
  return PastaValidationQueue::processData($data);
}

/**
 * Implements callback_cron_queue_info_worker().
 */
function pasta_submission_queue_process($data) {
  return PastaSubmissionQueue::processData($data);
}