You are here

views_lazy_load.module in Views Lazy Load 8

Same filename and directory in other branches
  1. 7 views_lazy_load.module

Module file for views_lazy_load.module.

File

views_lazy_load.module
View source
<?php

/**
 * @file
 * Module file for views_lazy_load.module.
 */

/**
 * Implements hook_views_api().
 */
function views_lazy_load_views_api() {
  return array(
    'api' => 3,
    'path' => drupal_get_path('module', 'views_lazy_load') . '/includes/views',
  );
}

/**
 * Implements hook_theme().
 */
function views_lazy_load_theme() {
  return array(
    'views_lazy_load_throbber' => array(),
  );
}

/**
 * Theme callback.
 */
function theme_views_lazy_load_throbber() {
  return '<div class="views-lazy-load">' . t('Loading') . '...</div>';
}

/**
 * Implements hook_html_head_alter().
 */
function views_html_head_alter() {
  if (variable_get('views_lazy_load_disable_alerts', FALSE)) {
    drupal_add_js(drupal_get_path('module', 'views_lazy_load') . '/js/disable-alert.js', array(
      'every_page' => TRUE,
    ));
  }
}

/**
 * Gets a regular expression of user agents to exclude.
 *
 * @return string
 *   A regex string to exclude user agents that don't use Views Lazy Load.
 */
function views_lazy_load_get_excluded_user_agents() {
  return variable_get('views_lazy_load_excluded_user_agents', 'Googlebot|msnbot|Rambler|Yahoo|AbachoBOT|accoona|AcioRobot|APSeek|CocoCrawler|Dumbot|FAST-WebCrawler|GeonaBot|Gigabot|Lycos|MSRBOT|Scooter|AltaVista|IDBot|eStyle|Scrubby');
}

Functions

Namesort descending Description
theme_views_lazy_load_throbber Theme callback.
views_html_head_alter Implements hook_html_head_alter().
views_lazy_load_get_excluded_user_agents Gets a regular expression of user agents to exclude.
views_lazy_load_theme Implements hook_theme().
views_lazy_load_views_api Implements hook_views_api().