From 7ec900bf9d83a67ea40845ea3a6b4914fb942604 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 16 Oct 2015 22:57:48 +0200 Subject: [PATCH] inspect/type: still ugly, debug-only --- application/controllers/InspectController.php | 15 +++++++++++++-- application/views/scripts/inspect/type.phtml | 12 ++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 application/views/scripts/inspect/type.phtml diff --git a/application/controllers/InspectController.php b/application/controllers/InspectController.php index 500e8111..785f3e4d 100644 --- a/application/controllers/InspectController.php +++ b/application/controllers/InspectController.php @@ -29,8 +29,19 @@ class Director_InspectController extends ActionController public function typeAction() { - print_r($this->api()->getType($this->params->get('name'))); - exit; + $typeName = $this->params->get('name'); + $this->view->type = $type = $this->api()->getType($typeName); + if ($type->abstract) { + return; + } + + if (! empty($type->fields)) { + $this->view->objects = $this->api()->getObjects( + $typeName, + $type->plural_name, + array_keys((array) $type->fields) + ); + } } protected function api() diff --git a/application/views/scripts/inspect/type.phtml b/application/views/scripts/inspect/type.phtml new file mode 100644 index 00000000..8884360b --- /dev/null +++ b/application/views/scripts/inspect/type.phtml @@ -0,0 +1,12 @@ +
+tabs ?> +

escape($this->title) ?>

+
+ +
+
+escape(print_r($this->type, 1)) ?>
+
+escape(print_r($this->objects, 1)) ?>
+
+