From c486cd074151f661346eb49fd0f855c1f8e71734 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Tue, 27 Jan 2015 11:11:40 -0500 Subject: [PATCH] Add API function to find Config by Name --- web/api/app/Controller/ConfigsController.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/web/api/app/Controller/ConfigsController.php b/web/api/app/Controller/ConfigsController.php index ea61f796d..e454d82ac 100644 --- a/web/api/app/Controller/ConfigsController.php +++ b/web/api/app/Controller/ConfigsController.php @@ -47,6 +47,19 @@ class ConfigsController extends AppController { )); } + public function viewByName($name = null) { + $config = $this->Config->findByName($name, array('fields' => 'Value')); + + if (!$config) { + throw new NotFoundException(__('Invalid config')); + } + + $this->set(array( + 'config' => $config['Config'], + '_serialize' => array('config') + )); + } + /** * edit method *