home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (locale_test.module)

This example Drupal source code file (locale_test.module) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, content, detected, displayed, function, groups, if, language_types, locale_test_language_types_info_alter, of, op, php, return, will

The locale_test.module Drupal example source code

<?php
// $Id: locale_test.module,v 1.6 2010/10/09 13:46:09 dries Exp $

/**
 * @file
 * Mock module for locale layer tests.
 */

/**
 * Implements hook_locale().
 */
function locale_test_locale($op = 'groups') {
  switch ($op) {
    case 'groups':
      return array('custom' => t('Custom'));
  }
}

/**
 * Implements hook_boot().
 *
 * For testing domain language negotiation, we fake it by setting
 * the HTTP_HOST here
 */
function locale_test_boot() {
  if (variable_get('locale_test_domain')) {
    $_SERVER['HTTP_HOST'] = variable_get('locale_test_domain');
  }
}

/**
 * Implements hook_language_types_info_alter().
 */
function locale_test_language_types_info_alter(array &$language_types) {
  if (variable_get('locale_test_content_language_type', FALSE)) {
    $language_types[LANGUAGE_TYPE_CONTENT] = array(
      'name' => t('Content'),
      'description' => t('Order of language detection methods for content. If a version of content is available in the detected language, it will be displayed.'),
    );
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal locale_test.module source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.