You are here

function better_field_descriptions_theme in Better Field Descriptions 7

Same name and namespace in other branches
  1. 8 better_field_descriptions.module \better_field_descriptions_theme()

Implements hook_theme().

File

./better_field_descriptions.module, line 68
Module file for the Better field descriptions module.

Code

function better_field_descriptions_theme($existing, $type, $theme, $path) {
  $bfd = variable_get('better_field_descriptions', array());

  // Find the theme template or use default if not configured.
  if (isset($bfd['template']) == FALSE || empty($bfd['template'])) {
    $template_file = 'better-field-descriptions-fieldset';
  }
  else {
    $template_file = $bfd['template'];
  }

  // Find the theme template URI .
  if ($template_file == 'better-field-descriptions-fieldset') {
    $template_uri = drupal_get_path('module', 'better_field_descriptions') . '/';
  }
  else {
    $template_uri = $bfd['template_uri'];
    $template_uri = str_replace('/' . $template_file . '.tpl.php', '', $template_uri);
  }
  return array(
    'better_field_descriptions' => array(
      'variables' => array(
        'label' => NULL,
        'description' => NULL,
        'field' => NULL,
      ),
      'template' => $template_file,
      'path' => $template_uri,
    ),
  );
}