You are here

extra_body_classes.module in Extra body classes 7

Same filename and directory in other branches
  1. 8 extra_body_classes.module

Main file for the Extra body classes module.

File

extra_body_classes.module
View source
<?php

/**
 * @file
 * Main file for the Extra body classes module.
 */

/**
 * Implements hook_help().
 */
function extra_body_classes_help($path, $arg) {
  switch ($path) {
    case 'admin/help#extra_body_classes':
      $path = dirname(__FILE__) . '/README.txt';
      if (file_exists($path)) {
        $readme = file_get_contents($path);
      }
      if (!isset($readme)) {
        return NULL;
      }
      if (module_exists('markdown')) {
        $filters = module_invoke('markdown', 'filter_info');
        $info = $filters['filter_markdown'];
        if (function_exists($info['process callback'])) {
          $output = $info['process callback']($readme, NULL);
        }
        else {
          $output = '<pre>' . $readme . '</pre>';
        }
      }
      else {
        $output = '<pre>' . $readme . '</pre>';
      }
      return $output;
  }
}

/**
 * Implements hook_menu().
 */
function extra_body_classes_menu() {
  $items = array();
  $items['admin/config/development/extra-body-classes'] = array(
    'title' => 'Extra body classes configuration',
    'description' => 'Configure the Extra body classes.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'extra_body_classes_configuration',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'file' => 'extra_body_classes.admin.inc',
  );
  return $items;
}

/**
 * Implements hook_preprocess_html().
 */
function extra_body_classes_preprocess_html(&$variables) {
  if (variable_get('extra_body_classes_timestamp', FALSE)) {
    $variables['classes_array'][] = date('Ymd');
  }
  if (variable_get('extra_body_classes_year', FALSE)) {
    $variables['classes_array'][] = date('Y');
  }
  if (variable_get('extra_body_classes_month', FALSE)) {
    $variables['classes_array'][] = lcfirst(date('F'));
  }
  if (variable_get('extra_body_classes_day', FALSE)) {
    $variables['classes_array'][] = lcfirst(date('l'));
  }
  if (variable_get('extra_body_classes_timezone', FALSE)) {
    $variables['classes_array'][] = lcfirst(str_replace('/', '-', date('e')));
  }
}

Functions

Namesort descending Description
extra_body_classes_help Implements hook_help().
extra_body_classes_menu Implements hook_menu().
extra_body_classes_preprocess_html Implements hook_preprocess_html().