CRM-10693 - change PRINT_JSON constant from '6' to 'json' for readability
[civicrm-core.git] / CRM / Core / Controller.php
index 21a4ac461b3686fa30c2a2e9eee793b5096a610c..1c9b09ddd231eef16c40ff299ae6119a81b0b73c 100644 (file)
@@ -240,8 +240,9 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
         // also used for the various tabs via TabHeader
         $this->_print = CRM_Core_Smarty::PRINT_NOFORM;
       }
-      elseif ($snippet == 6) {
-        $this->_print = CRM_Core_Smarty::PRINT_NOFORM;
+      // Respond with JSON if in AJAX context (also support legacy value '6')
+      elseif (in_array($snippet, array(CRM_Core_Smarty::PRINT_JSON, 6))) {
+        $this->_print = CRM_Core_Smarty::PRINT_JSON;
         $this->_QFResponseType = 'json';
       }
       else {