Skip to content

Commit

Permalink
API Deprecate Controller::has_curr()
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Feb 13, 2025
1 parent 9622ff0 commit b8df03b
Showing 1 changed file with 4 additions and 0 deletions.
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

0 comments on commit b8df03b

Please sign in to comment.