mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
APICHANGE: changed BaseHref to AbsoluteBaseURL for consistency. FEATURE: added BaseURL for getting non absolute value. PATCH via muzdowski (#6158)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@114815 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ac851e6f82
commit
21f84c9513
@ -22,8 +22,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $casting = array (
|
||||
'BaseHref' => 'Varchar',
|
||||
public static $casting = array(
|
||||
'CSSClasses' => 'Varchar'
|
||||
);
|
||||
|
||||
@ -712,11 +711,34 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
|
||||
/**
|
||||
* @see Director::absoluteBaseURL()
|
||||
*
|
||||
* @deprecated 3.0
|
||||
*/
|
||||
public function BaseHref() {
|
||||
user_error("Please use AbsoluteBaseURL", E_USER_WARNING);
|
||||
|
||||
return $this->AbsoluteBaseURL();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the absolute base url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function AbsoluteBaseURL() {
|
||||
return Director::absoluteBaseURL();
|
||||
}
|
||||
|
||||
/**
|
||||
* Access the BaseURL from template: proxy the value from the Director.
|
||||
* Needed for building hardcoded links.
|
||||
*
|
||||
* @return string base url
|
||||
*/
|
||||
function BaseURL() {
|
||||
return Director::baseURL();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Director::is_ajax()
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
<p><% _t('HELLO', 'Hi') %> $FirstName,</p>
|
||||
|
||||
<p>
|
||||
<% _t('CHANGEPASSWORDTEXT1', 'You changed your password for', PR_MEDIUM, 'for a url') %> $BaseHref.<br />
|
||||
<% _t('CHANGEPASSWORDTEXT1', 'You changed your password for', PR_MEDIUM, 'for a url') %> $AbsoluteBaseURL.<br />
|
||||
<% _t('CHANGEPASSWORDTEXT2', 'You can now use the following credentials to log in:') %>
|
||||
</p>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<p><% _t('HELLO', 'Hi') %> $FirstName,</p>
|
||||
|
||||
<p><% _t('TEXT1', 'Here is your') %> <a href="$PasswordResetLink"><% _t('TEXT2', 'password reset link') %></a> <% _t('TEXT3', 'for') %> $BaseHref.</p>
|
||||
<p><% _t('TEXT1', 'Here is your') %> <a href="$PasswordResetLink"><% _t('TEXT2', 'password reset link') %></a> <% _t('TEXT3', 'for') %> $AbsoluteBaseURL.</p>
|
||||
|
||||
|
@ -130,6 +130,10 @@ class ControllerTest extends FunctionalTest {
|
||||
);
|
||||
}
|
||||
|
||||
public function testBaseURL() {
|
||||
Director::setBaseURL('/baseurl/');
|
||||
$this->assertEquals(Controller::BaseURL(), Director::BaseURL());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user