You are here

protected function AcquiaPurgeProcessorAjax::initializeClientSideProcessor in Acquia Purge 7

Load the static assets to load and show the client side processor.

1 call to AcquiaPurgeProcessorAjax::initializeClientSideProcessor()
AcquiaPurgeProcessorAjax::onInit in lib/processor/AcquiaPurgeProcessorAjax.php
Implements event onInit.

File

lib/processor/AcquiaPurgeProcessorAjax.php, line 293
Contains AcquiaPurgeProcessorAjax.

Class

AcquiaPurgeProcessorAjax
Process the queue using a AJAX client-side UI.

Code

protected function initializeClientSideProcessor() {
  if (!$this->initialized) {

    // Load the AJAX processor behavior. As soon as the bahvior is loaded it
    // starts hitting /acquia_purge_ajax_processor, which in turn will process
    // a chunk from the queue. With queue locking in place, multiple requests
    // will not do any harm.
    drupal_add_js($this->jsClient);

    // Although the behavior always loads and works the queue, it doesn't mean
    // its always presented to the user. Print the DSM message when needed.
    if ($this
      ->isUiVisible()) {
      $message = t("There have been changes to content, and these need to be\n          refreshed throughout the system. There may be a delay before the changes\n          appear to all website visitors.");
      drupal_set_message($message, 'acquia_purge_messages', FALSE);

      // Add inline CSS to hide the DSM box, this covers cases where the
      // script didn not yet or could not load (see d.o. 2014461).
      drupal_add_css('.acquia_purge_messages {display:none;}', array(
        'type' => 'inline',
      ));
    }
    $this->initialized = TRUE;
  }
}