You are here

function acquia_purge_block_view in Acquia Purge 7

Implements hook_block_view().

File

./acquia_purge.module, line 315
Acquia Purge, Top-notch Varnish purging on Acquia Cloud!

Code

function acquia_purge_block_view($delta = '') {

  // Render one of the manual purge blocks.
  if (in_array($delta, array(
    'page',
    'paths',
  ))) {
    if (!user_access('use manual purge blocks')) {
      return array();
    }
    if ($_GET['q'] == 'admin/config/development/performance/manualpurge') {
      return array();
    }
    if (_acquia_purge_service()
      ->diagnostics()
      ->isSystemBlocked()) {
      return array();
    }

    // Load acquia_purge.admin.inc to be able to call our form callback.
    module_load_include('inc', 'acquia_purge', 'acquia_purge.admin');
    return array(
      'subject' => $delta === 'paths' ? t('Refresh paths') : NULL,
      'content' => drupal_get_form("acquia_purge_manualpurge_form_{$delta}"),
    );
  }
  return array();
}