1 admin_bar.inc admin_bar_links_alert()

Build alert indicator.

File

core/modules/admin_bar/admin_bar.inc, line 661
Menu builder functions for Administration bar.

Code

function admin_bar_links_alert() {
  $alert = array();
  // Check requirements.
  include_once BACKDROP_ROOT . '/core/includes/install.inc';
  $requirements = system_get_requirements();
  if (backdrop_requirements_severity($requirements) == REQUIREMENT_ERROR) {
    // Count the errors.
    $count = 0;
    foreach ($requirements as $requirement) {
      if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
        $count++;
      }
    }
    $alert = array(
      '#theme' => 'admin_bar_links',
      '#wrapper_attributes' => array(
        'id' => 'admin-bar-alert',
      ),
      '#weight' => 20,
    );

    // Add a link to the status report.
    $alert['alert'] = array(
      '#title' => '<span class="error-label">' . t('Site status') . '</span><span class="error-count">' . $count . '</span>',
      '#attributes' => array(
        'title' => format_plural($count, 'One problem was detected with your Backdrop installation.', 'Several problems were detected with your Backdrop installation.'),
        'class' => array('admin-bar-alert', 'admin-bar-alert-error'),
      ),
      '#href' => 'admin/reports/status',
      '#access' => user_access('administer site configuration'),
      '#options' => array('html' => TRUE),
    );
  }

  return $alert;
}