You are here

public function fcIncomplete::render in Field Complete 7

File

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

Class

fcIncomplete

Code

public function render($depth = 0) {

  // Don't output if complete
  if ($this->complete) {
    return array();
  }
  list($entity_type, $bundle) = $this
    ->entityType();
  $build = array(
    '#prefix' => '<div class="fc-incomplete-section" style="margin-left:' . $depth . 'em">',
    '#suffix' => '</div>',
    'header' => array(
      '#theme' => 'fc_incomplete_header',
      '#complete' => $this->complete,
      '#name' => $this->name,
      '#entity_type' => $entity_type,
      '#entity' => $this->entity,
      '#bundle' => $bundle,
      '#depth' => $depth,
    ),
    'parts' => array(
      '#prefix' => '<ul>',
      '#suffix' => '</ul>',
    ),
  );
  foreach ((array) $this as $sub) {
    if (is_object($sub) && !$sub->complete) {
      $build['parts'][] = array(
        '#prefix' => '<li>',
        '#suffix' => '</li>',
        'sub-item' => $sub
          ->render($depth + 1),
      );
    }
  }
  return $build;
}