You are here

function brb_widget in Browser Bouncer (brb) 7

Create the brb widget to display after the page is loaded.

1 call to brb_widget()
brb_process_html in ./brb.module
Implementation of hook_preprocess_html().

File

./brb.module, line 190
Display a message to let the user knows his/her browser is not supported. This message also offer to the user different browsers that can be used instead.

Code

function brb_widget() {
  $body = variable_get('brb_body', 'Sorry but your browser is not supported.');

  // Drag and drop table
  $browsers = variable_get('brb_browsers', array());
  uasort($browsers, 'brb_cmp');

  // Remove excluded browsers
  $ok_browsers = array();
  foreach ($browsers as $browser) {
    if (!$browser->exclude) {
      $ok_browsers[] = array(
        "id" => 'brb-' . drupal_strtolower(str_replace(' ', '-', $browser->name)),
        "name" => $browser->name,
        'url' => $browser->url,
        "attributes" => array(
          'class' => 'brb-browser',
          'title' => $browser->name,
        ),
      );
    }
  }
  return theme('brb_widget', array(
    'body' => $body,
    'browsers' => $ok_browsers,
  ));
}