Skip to content

Commit

Permalink
[gh-152] Merging testing into staging -c758
Browse files Browse the repository at this point in the history
git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@839 20a16fea-79d4-4915-8869-1ea9d5ebf173
  • Loading branch information
Eric Rasmussen committed Jul 11, 2011
1 parent 7311c5d commit 6883755
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
52 changes: 52 additions & 0 deletions field.tpl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

/**
* @file field.tpl.php
* unl_wdn template implementation to display the value of a field.
*
* Available variables:
* - $items: An array of field values. Use render() to output them.
* - $label: The item label.
* - $label_hidden: Whether the label display is set to 'hidden'.
* - $label_html_tag: The html tag to use for the label, h2, h3, div, etc.
* - $classes: String of classes that can be used to style contextually through
* CSS. It can be manipulated through the variable $classes_array from
* preprocess functions. The default values can be one or more of the
* following:
* - field: The current template type, i.e., "theming hook".
* - field-name-[field_name]: The current field name. For example, if the
* field name is "field_description" it would result in
* "field-name-field-description".
* - field-type-[field_type]: The current field type. For example, if the
* field type is "text" it would result in "field-type-text".
* - field-label-[label_display]: The current label position. For example, if
* the label position is "above" it would result in "field-label-above".
*
* Other variables:
* - $element['#object']: The entity to which the field is attached.
* - $element['#view_mode']: View mode, e.g. 'full', 'teaser'...
* - $element['#field_name']: The field name.
* - $element['#field_type']: The field type.
* - $element['#field_language']: The field language.
* - $element['#field_translatable']: Whether the field is translatable or not.
* - $element['#label_display']: Position of label display, inline, above, or
* hidden.
* - $field_name_css: The css-compatible field name.
* - $field_type_css: The css-compatible field type.
* - $classes_array: Array of html class attribute values. It is flattened
* into a string within the variable $classes.
*
* @see template_preprocess_field()
* @see theme_field()
*/
?>
<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
<?php if (!$label_hidden) : ?>
<<?php print $label_html_tag; ?> class="field-label"<?php print $title_attributes; ?>><?php print $label ?>:&nbsp;</<?php print $label_html_tag; ?>>
<?php endif; ?>
<div class="field-items"<?php print $content_attributes; ?>>
<?php foreach ($items as $delta => $item) : ?>
<div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></div>
<?php endforeach; ?>
</div>
</div>
17 changes: 17 additions & 0 deletions template.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ function unl_wdn_css_alter(&$css) {
unset($css[$path.'/system.theme.css']);
}

/**
* Implements template_preprocess_field().
*/
function unl_wdn_preprocess_field(&$vars, $hook) {
$element = $vars['element'];
// Set the field label tag to a header or default to div
if (strlen($element['#label_display']) == 2 && substr($element['#label_display'], 0, 1) == 'h') {
$vars['label_html_tag'] = $element['#label_display'];
}
else {
$vars['label_html_tag'] = 'div';
}
}

/**
* Implements template_preprocess_html().
*/
function unl_wdn_preprocess_html(&$vars, $hook) {
/**
* Change the <title> tag to UNL format: UNL | Department | Section | Page
Expand Down

0 comments on commit 6883755

Please sign in to comment.