You are here

browserclass.api.php in Browser Class 7

Same filename and directory in other branches
  1. 6 browserclass.api.php

Sample hooks demonstrating usage in Browser class module.

File

browserclass.api.php
View source
<?php

/**
 * @file
 * Sample hooks demonstrating usage in Browser class module.
 */

/**
 * Add new classes to the body.
 *
 * The returnd array will merged with browserclass module's detected classes.
 * Create the conditions by user agent.
 *
 * @param string $agent
 *   Lowercase version of user agent.
 *
 * @return array
 *   An array of defined classes.
 */
function hook_browserclass_classes($agent) {
  $classes = [];
  if (stristr($agent, 'something') !== FALSE) {
    $classes[] = 'myclass';
  }
  if (stristr($agent, 'something2') !== FALSE) {
    $classes[] = 'myclass2';
  }
  return $classes;
}

Functions

Namesort descending Description
hook_browserclass_classes Add new classes to the body.