You are here

function scheduler_feeds_processor_targets_alter in Scheduler 7

Same name and namespace in other branches
  1. 8 scheduler.module \scheduler_feeds_processor_targets_alter()
  2. 2.x scheduler.module \scheduler_feeds_processor_targets_alter()

Implements hook_feeds_processor_targets_alter().

This function exposes publish_on and unpublish_on as mappable targets to the Feeds module.

File

./scheduler.module, line 844
Scheduler publishes and unpublishes nodes on dates specified by the user.

Code

function scheduler_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {

  // Scheduler module only works on nodes.
  if ($entity_type == 'node') {
    $publishing_enabled = variable_get('scheduler_publish_enable_' . $bundle_name, 0);
    $unpublishing_enabled = variable_get('scheduler_unpublish_enable_' . $bundle_name, 0);
    if ($publishing_enabled) {
      $targets['publish_on'] = array(
        'name' => t('Scheduler: publish on'),
        'description' => t('The date when the Scheduler module will publish the node.'),
        'callback' => 'scheduler_feeds_set_target',
      );
    }
    if ($unpublishing_enabled) {
      $targets['unpublish_on'] = array(
        'name' => t('Scheduler: unpublish on'),
        'description' => t('The date when the Scheduler module will unpublish the node.'),
        'callback' => 'scheduler_feeds_set_target',
      );
    }
  }
}