mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Update requesthandlers with missing extension points
This commit is contained in:
parent
28255b79eb
commit
386ef27f65
@ -363,7 +363,9 @@ class FormField extends RequestHandler
|
||||
*/
|
||||
public function Link($action = null)
|
||||
{
|
||||
return Controller::join_links($this->form->FormAction(), 'field/' . $this->name, $action);
|
||||
$link = Controller::join_links($this->form->FormAction(), 'field/' . $this->name, $action);
|
||||
$this->extend('updateLink', $link, $action);
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,15 +85,15 @@ class FormRequestHandler extends RequestHandler
|
||||
|
||||
// Respect FormObjectLink() method
|
||||
if ($controller->hasMethod("FormObjectLink")) {
|
||||
return Controller::join_links(
|
||||
$controller->FormObjectLink($this->form->getName()),
|
||||
$action,
|
||||
'/'
|
||||
);
|
||||
$base = $controller->FormObjectLink($this->form->getName());
|
||||
} else {
|
||||
$base = Controller::join_links($controller->Link(), $this->form->getName());
|
||||
}
|
||||
|
||||
// Default form link
|
||||
return Controller::join_links($controller->Link(), $this->form->getName(), $action, '/');
|
||||
// Join with action and decorate
|
||||
$link = Controller::join_links($base, $action, '/');
|
||||
$this->extend('updateLink', $link, $action);
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,6 @@ use Psr\Container\NotFoundExceptionInterface;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Control\HTTPResponse;
|
||||
use SilverStripe\Control\RequestHandler;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||
use SilverStripe\ORM\FieldType\DBField;
|
||||
@ -25,9 +24,11 @@ class ChangePasswordHandler extends RequestHandler
|
||||
protected $authenticator;
|
||||
|
||||
/**
|
||||
* Link to this handler
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $link;
|
||||
protected $link = null;
|
||||
|
||||
/**
|
||||
* @var array Allowed Actions
|
||||
@ -123,8 +124,8 @@ class ChangePasswordHandler extends RequestHandler
|
||||
. '<p>You can request a new one <a href="{link1}">here</a> or change your password after'
|
||||
. ' you <a href="{link2}">logged in</a>.</p>',
|
||||
[
|
||||
'link1' => $this->link('lostpassword'),
|
||||
'link2' => $this->link('login')
|
||||
'link1' => $this->Link('lostpassword'),
|
||||
'link2' => $this->Link('login')
|
||||
]
|
||||
)
|
||||
);
|
||||
@ -164,16 +165,15 @@ class ChangePasswordHandler extends RequestHandler
|
||||
/**
|
||||
* Return a link to this request handler.
|
||||
* The link returned is supplied in the constructor
|
||||
* @param null $action
|
||||
*
|
||||
* @param string|null $action
|
||||
* @return string
|
||||
*/
|
||||
public function link($action = null)
|
||||
public function Link($action = null)
|
||||
{
|
||||
if ($action) {
|
||||
return Controller::join_links($this->link, $action);
|
||||
}
|
||||
|
||||
return $this->link;
|
||||
$link = Controller::join_links($this->link, $action);
|
||||
$this->extend('updateLink', $link, $action);
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,9 +41,11 @@ class LoginHandler extends RequestHandler
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string Called link on this handler
|
||||
* Link to this handler
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $link;
|
||||
protected $link = null;
|
||||
|
||||
/**
|
||||
* @param string $link The URL to recreate this request handler
|
||||
@ -59,16 +61,15 @@ class LoginHandler extends RequestHandler
|
||||
/**
|
||||
* Return a link to this request handler.
|
||||
* The link returned is supplied in the constructor
|
||||
*
|
||||
* @param null|string $action
|
||||
* @return string
|
||||
*/
|
||||
public function link($action = null)
|
||||
public function Link($action = null)
|
||||
{
|
||||
if ($action) {
|
||||
return Controller::join_links($this->link, $action);
|
||||
}
|
||||
|
||||
return $this->link;
|
||||
$link = Controller::join_links($this->link, $action);
|
||||
$this->extend('updateLink', $link, $action);
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,7 +153,7 @@ class LoginHandler extends RequestHandler
|
||||
|
||||
public function getReturnReferer()
|
||||
{
|
||||
return $this->link();
|
||||
return $this->Link();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,12 @@ class LostPasswordHandler extends RequestHandler
|
||||
'passwordsent',
|
||||
];
|
||||
|
||||
private $link = null;
|
||||
/**
|
||||
* Link to this handler
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $link = null;
|
||||
|
||||
/**
|
||||
* @param string $link The URL to recreate this request handler
|
||||
@ -59,16 +64,14 @@ class LostPasswordHandler extends RequestHandler
|
||||
* Return a link to this request handler.
|
||||
* The link returned is supplied in the constructor
|
||||
*
|
||||
* @param string $action
|
||||
* @param string|null $action
|
||||
* @return string
|
||||
*/
|
||||
public function link($action = null)
|
||||
public function Link($action = null)
|
||||
{
|
||||
if ($action) {
|
||||
return Controller::join_links($this->link, $action);
|
||||
}
|
||||
|
||||
return $this->link;
|
||||
$link = Controller::join_links($this->link, $action);
|
||||
$this->extend('updateLink', $link, $action);
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -261,7 +264,7 @@ class LostPasswordHandler extends RequestHandler
|
||||
protected function redirectToSuccess(array $data)
|
||||
{
|
||||
$link = Controller::join_links(
|
||||
$this->link('passwordsent'),
|
||||
$this->Link('passwordsent'),
|
||||
rawurlencode($data['Email']),
|
||||
'/'
|
||||
);
|
||||
|
@ -483,7 +483,9 @@ class Security extends Controller implements TemplateGlobalProvider
|
||||
public function Link($action = null)
|
||||
{
|
||||
/** @skipUpgrade */
|
||||
return Controller::join_links(Director::baseURL(), "Security", $action);
|
||||
$link = Controller::join_links(Director::baseURL(), "Security", $action);
|
||||
$this->extend('updateLink', $link, $action);
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user