Skip to content

Make outputResponseJson() and outputResponseHtml() protected#1537

Closed
PhilippGrashoff wants to merge 1 commit intoatk4:developfrom
PhilippGrashoff:make_outputresponseHTMLandJSON_protected_not_private
Closed

Make outputResponseJson() and outputResponseHtml() protected#1537
PhilippGrashoff wants to merge 1 commit intoatk4:developfrom
PhilippGrashoff:make_outputresponseHTMLandJSON_protected_not_private

Conversation

@PhilippGrashoff
Copy link
Copy Markdown
Collaborator

@PhilippGrashoff PhilippGrashoff commented Nov 16, 2020

These methods were private before, making it unneccessarily hard for example to overwrite caughtException(). In my case, I want to return a jsToast if it was a JS request, not a full page load:

 //this code is in the if clause that checks if it was a JS request
$jsToast = new JsToast(['message' => $message, 'class' => 'error']);
           $this->outputResponseJson(
                [
                    'success' => true,
                    'message' => '',
                    'atkjs' => $jsToast->jsRender()
                ]
            );

Copy link
Copy Markdown
Member

@mvorisek mvorisek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these methods are intended to be private as they may be removed once output is reworked

in atk - these are too low level methods - you should break execution using some callback and return the data from it with specific mime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants