You are here

function fc_progress_preprocess_fc_progress_bar in Field Complete 7

File

fc_progress/fc_progress.blocks.inc, line 41
Field Complete Progress - Provides blocks to display a progress bar of Field completion - blocks.

Code

function fc_progress_preprocess_fc_progress_bar(&$variables) {
  $entity_type = $variables['entity_type'];
  $entity = $variables['entity'];
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
  if (empty($entity->fc)) {
    $entity->fc = fcComplete::load($entity_type, $entity);
  }
  $variables['fc_complete'] = $entity->fc->complete;
  $variables['fc_percentage'] = $entity->fc->percentage;
  $variables['fc_completeness'] = $entity->fc->completeness;
  $variables['percent_complete'] = t('@pc% complete', array(
    '@pc' => $entity->fc->percentage,
  ));
  $variables['classes_array'][] = "fc-progress-bar-{$entity_type}";
  $variables['classes_array'][] = "fc-progress-bar-{$entity_type}-{$bundle}";
  $variables['classes_array'][] = 'fc-progress-bar-' . ($entity->fc->complete ? 'complete' : 'incomplete');
  $variables['theme_hook_suggestions'][] = "fc-progress-bar";
  $variables['theme_hook_suggestions'][] = "fc-progress-bar--{$entity_type}";
  $variables['theme_hook_suggestions'][] = "fc-progress-bar--{$entity_type}--{$bundle}";
  $variables['theme_hook_suggestions'][] = "fc-progress-bar--{$entity_type}--{$id}";
}