From 4096f9808b424d33131db5bd8b17acac689eb8b8 Mon Sep 17 00:00:00 2001 From: ppound Date: Thu, 14 Oct 2021 14:32:47 -0300 Subject: [PATCH] tidied up comments in controller --- .../Controller/RoblibSearchEdsController.php | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/modules/roblib_search_eds/src/Controller/RoblibSearchEdsController.php b/modules/roblib_search_eds/src/Controller/RoblibSearchEdsController.php index b8bbefc..58d9d61 100644 --- a/modules/roblib_search_eds/src/Controller/RoblibSearchEdsController.php +++ b/modules/roblib_search_eds/src/Controller/RoblibSearchEdsController.php @@ -11,22 +11,17 @@ use Drupal\roblib_search_eds\Lib\EBSCOAPI; class RoblibSearchEdsController extends ControllerBase { /** - * Display the markup. + * Print JSON. * - * @return array - * A renderable array. */ public function articleResults($query = NULL) { print $this->eds_get_results($query, 'Articles'); - exit(); - + exit(); } /** - * Display the markup. + * Print JSON. * - * @return array - * A renderable array. */ public function bookResults($query = NULL) { print $this->eds_get_results($query, 'Books'); @@ -34,10 +29,13 @@ class RoblibSearchEdsController extends ControllerBase { } /** - * + * Query EBSCO using the EDS API. * @param string $query + * The search term(s) to send to EBSCO. + * @param string type + * The type of search, either Books or Articles. * @return string - * json string + * A JSON string */ function eds_get_results($query = NULL, $type = 'Articles') { //drupal_add_css(drupal_get_path('module', 'roblib_search_eds') . '/css/roblib_search_eds.theme.css'); @@ -69,8 +67,7 @@ class RoblibSearchEdsController extends ControllerBase { $output = $eds_api->apiSearch($search, $filters, 1, $number_per_page); $output['is_local_ip'] = $is_local_ip; - print json_encode($output); - exit(); + return json_encode($output); } /**