You are here

function object_log_build_objects in Object Log 7

Display stored objects for inspection.

Parameters

$labels: An array of labels representing objects to be displayed.

Return value

A render array of objects ready for inspection.

1 call to object_log_build_objects()
object_log_object_page in ./object_log.admin.inc
Menu callback function for "admin/reports/object_log/$label".

File

./object_log.admin.inc, line 111

Code

function object_log_build_objects($labels = array()) {
  $build = array();
  $build['objects'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'id' => 'object_log_objects',
      'class' => array(
        'object-log',
        'object-count-' . count($labels),
        'clearfix',
      ),
    ),
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'object_log') . '/object_log.admin.css',
      ),
    ),
  );
  foreach ($labels as $delta => $label) {
    if ($object = object_log_build_object($label)) {
      $build['objects'][$delta] = $object;
    }
    else {
      $markup = '<div class="object"><h4 class="object-label">' . check_plain($label) . '</h4><p>' . t('Not in log.') . '</p></div>';
      $build['objects'][$delta] = array(
        '#type' => 'markup',
        '#markup' => $markup,
      );
    }
  }
  return $build;
}