You are here

function acquia_lift_batch_sync_actions in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 acquia_lift_profiles/acquia_lift_profiles.batch.inc \acquia_lift_batch_sync_actions()

Batch syncs actions to Lift Web.

Parameters

array $actions: The actions to sync.

1 call to acquia_lift_batch_sync_actions()
acquia_lift_profiles_creds_submit in acquia_lift_profiles/acquia_lift_profiles.module
Submit callback for the Acquia Lift admin form.

File

acquia_lift_profiles/acquia_lift_profiles.batch.inc, line 13
acquia_lift_profiles.batch.inc Provides Acquia Lift Profiles batch functions.

Code

function acquia_lift_batch_sync_actions($actions = array()) {
  if (empty($actions)) {
    $actions = visitor_actions_get_actions();
  }
  $batch_operations = array();
  foreach ($actions as $action_name => $info) {
    $label = acquia_lift_profiles_get_label_for_action($info);
    $operation = array(
      'label' => $label,
      'action_name' => $action_name,
    );
    $batch_operations[] = array(
      'acquia_lift_profiles_batch_sync_action',
      array(
        $operation,
      ),
    );
  }
  $batch = array(
    'operations' => $batch_operations,
    'finished' => 'acquia_lift_profiles_batch_finished',
    'title' => t('Syncing visitor actions to Acquia Lift Web'),
    'init_message' => t('Starting action sync.'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('Lift Profiles action sync has encountered an error.'),
    'file' => drupal_get_path('module', 'acquia_lift_profiles') . '/acquia_lift_profiles.batch.inc',
  );
  batch_set($batch);
}