Add API function to find Config by Name

This commit is contained in:
Kyle Johnson 2015-01-27 11:11:40 -05:00
parent 7a5ee71080
commit c486cd0741
1 changed files with 13 additions and 0 deletions

View File

@ -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
*