You are here

function fc_incomplete_preprocess_fc_incomplete_header in Field Complete 7

Implements hook_preprocess_fc_incomplete_header().

File

fc_incomplete/fc_incomplete.module, line 35
Field Incomplete - Provides a block displaying of what's currently incomplete on an entity.

Code

function fc_incomplete_preprocess_fc_incomplete_header(&$vars) {
  if (fc_entity_is_enabled($vars['entity_type'])) {
    $field_info = field_info_fields();
    $vars['extras'] = '';
    if (!$vars['name'] && $vars['entity']) {
      $entity_name = theme('fc_incomplete_entity_name', $vars);
      $vars['header'] = entity_label($vars['entity_type'], $vars['entity']) . ' ' . $entity_name;
      $vars['classes_array'][] = 'fc-incomplete-entity';
    }
    elseif ($vars['name']) {
      if ($vars['bundle']) {
        $instance = field_info_instance($vars['entity_type'], $vars['name'], $vars['bundle']);
        $vars['header'] = $instance['label'];
      }
      else {
        $field = $field_info[$vars['name']];
        $vars['header'] = $vars['name'];
      }
    }
    else {
      $vars['header'] = $vars['name'];
    }
    $vars['complete'] = theme('fc_incomplete_complete', $vars);
  }
}