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

API Deprecate Controller::has_curr() #11614

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Control/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SilverStripe\Security\Security;
use SilverStripe\View\SSViewer;
use SilverStripe\View\TemplateGlobalProvider;
use SilverStripe\Dev\Deprecation;

/**
* Controllers are the cornerstone of all site functionality in SilverStripe. The {@link Director}
Expand Down Expand Up @@ -520,6 +521,7 @@ public static function curr()
if (Controller::$controller_stack) {
return Controller::$controller_stack[0];
}
// This user_error() will be removed in the next major version of Silverstripe CMS
user_error("No current controller available", E_USER_WARNING);
return null;
}
Expand All @@ -529,9 +531,11 @@ public static function curr()
* controller in the stack.
*
* @return bool
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it
*/
public static function has_curr()
{
Deprecation::noticeWithNoReplacment('5.4.0');
return Controller::$controller_stack ? true : false;
}

Expand Down
Loading