You are here

a11y_titles.module in A11y titles 6

Provides open access to content titles.

File

a11y_titles.module
View source
<?php

/**
 * @file
 * Provides open access to content titles.
 */

/**
 * Implements hook_form_FORM_ID_alter().
 */
function a11y_titles_form_block_admin_configure_alter(&$form, &$form_state) {
  module_load_include('inc', 'a11y_titles', 'a11y_titles.admin');
  _a11y_titles_form_block_admin_configure_alter($form, $form_state);
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
function a11y_titles_form_block_add_block_form_alter(&$form, &$form_state) {
  module_load_include('inc', 'a11y_titles', 'a11y_titles.admin');
  _a11y_titles_form_block_admin_configure_alter($form, $form_state);
}

/**
 * Implements hook_preprocess_block().
 */
function a11y_titles_preprocess_block(&$variables) {

  // Grab the display value;
  $blocks = variable_get('a11y_titles_blocks', array());
  $display = isset($blocks[$variables['block']->module . '--' . $variables['block']->delta]) ? $blocks[$variables['block']->module . '--' . $variables['block']->delta] : 'normal';

  // Optionally hide the block title.
  switch ($display) {
    case 'invisible':
      if (isset($variables['classes'])) {
        $variables['classes'] .= ' title-element-invisible';
      }
      else {
        $variables['classes'] = 'title-element-invisible';
      }
      break;
    case 'hidden':
      $variables['block']->subject = '';
      break;
  }
}

/**
 * Implements hook_init().
 */
function a11y_titles_init() {
  drupal_add_css(drupal_get_path('module', 'a11y_titles') . '/a11y-titles.css');
}