You are here

public function ObjectLogController::objectDetails in Object Log 8

Display a stored object.

Parameters

string $label: The name associated with the stored object.

Return value

array A Drupal render array.

Throws

\Symfony\Component\HttpKernel\Exception\NotFoundHttpException

1 string reference to 'ObjectLogController::objectDetails'
object_log.routing.yml in ./object_log.routing.yml
object_log.routing.yml

File

src/Controller/ObjectLogController.php, line 135
Contains \Drupal\object_log\Controller\ObjectLogController.

Class

ObjectLogController
Contains callbacks for Object Log routes.

Namespace

Drupal\object_log\Controller

Code

public function objectDetails($label) {
  $log = object_log_retrieve($label);
  if (!$log) {
    throw new NotFoundHttpException();
  }
  $object = $log->data;
  $build = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array(
        'object_wrapper',
      ),
    ),
  );
  $build['title'] = array(
    '#plain_text' => $label,
    '#prefix' => '<h4 class="object-label">',
    '#suffix' => '</h4>',
  );
  $build['object'] = array(
    '#type' => 'markup',
    '#markup' => kpr($object, TRUE, NULL),
    '#prefix' => '<div class="object">',
    '#suffix' => '</div>',
  );
  $build['listing'] = $this
    ->listing();
  return $build;
}