function cis_helper_cron

cis7 cis_helper.module cis_helper_cron()

Implements hook_cron().

File

profiles/cis/modules/custom/cis_helper/cis_helper.module, line 20
Workflow and functionality glue based on the structure of the CIS.

Code

function cis_helper_cron() {
  $query = new EntityFieldQuery;
  $result = $query
  // pull all field collections
  ->entityCondition('entity_type', 'field_collection_item')
  // that are sections
  ->entityCondition('bundle', 'field_sections')
  // that aren't archived
  ->propertyCondition('archived', 0)
  // that have something in the cis_ops field
  ->fieldCondition('field_cis_ops', 'value', 'NULL', '!=')
  // run as user 1 to avoid issues of ability to load as cron is anon
  ->addMetaData('account', user_load(1))->execute();
  // load the instances
  if (isset($result['field_collection_item'])) {
    $sections = entity_load('field_collection_item', array_keys($result['field_collection_item']));
    foreach ($sections as $section) {
      // handle the logic of the operation to perform
      _cis_helper_run_operation($section);
    }
  }
}