You are here

public function UltimateCronBackgroundProcessLegacyLauncher::build_operations_alter in Ultimate Cron 7.2

Use ajax for run, since we're launching in the background.

Overrides UltimateCronPlugin::build_operations_alter

File

plugins/ultimate_cron/launcher/background_process_legacy.class.php, line 74
Background Process 1.x launcher for Ultimate Cron.

Class

UltimateCronBackgroundProcessLegacyLauncher
Ultimate Cron launcher plugin class.

Code

public function build_operations_alter($job, &$allowed_operations) {
  if (!empty($allowed_operations['run'])) {
    $allowed_operations['run']['attributes'] = array(
      'class' => array(
        'use-ajax',
      ),
    );
  }
  else {
    $settings = $job
      ->getSettings('launcher');
    if ($settings['daemonize'] && !$job
      ->peekSignal('end_daemonize')) {
      unset($allowed_operations['kill']);
      $allowed_operations['end_daemonize'] = array(
        'title' => t('Kill daemon'),
        'href' => 'admin/config/system/cron/jobs/list/' . $job->name . '/signal/' . $this->type . '/' . $this->name . '/end_daemonize',
        'attributes' => array(
          'class' => array(
            'use-ajax',
          ),
        ),
        'query' => array(
          'token' => drupal_get_token('signal'),
        ),
      );
    }
  }
}