You are here

function node_field_preprocess_node_field_field in Node Field 7.2

Implements hook_preprocess_THEME().

File

./node_field.module, line 292
This module provide ability to add extra fields to any single node.

Code

function node_field_preprocess_node_field_field(&$vars) {

  // Default element.
  $element = $vars['element'];

  // Class.
  $class = [];
  $class[] = $element['#node_field']['show_title'] ? 'with-title' : 'without-title';
  $class[] = 'type-' . $element['#node_field']['type'];
  $vars['class'] = implode(' ', $class);

  // Show title.
  $vars['show_title'] = $element['#node_field']['show_title'];
  $vars['hidden'] = $element['#node_field']['hidden'];
  $vars['title'] = check_plain($element['#node_field']['title']);
  $vars['value'] = $element['#node_field']['value'];
}