Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make outputResponseJson() and outputResponseHtml() protected #1537

Conversation

PhilippGrashoff
Copy link
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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants