Change fullPath option to fullBase in HtmlHelper::image for consistency

Updated test cases for that.
Included doc block about that option.
This commit is contained in:
Cauan Cabral 2012-01-18 08:32:40 -03:00
parent 90426674cb
commit 03bac42366
2 changed files with 6 additions and 5 deletions

View file

@ -353,7 +353,7 @@ class HtmlHelperTest extends CakeTestCase {
$result = $this->Html->image('/test/view/1.gif');
$this->assertTags($result, array('img' => array('src' => '/test/view/1.gif', 'alt' => '')));
$result = $this->Html->image('test.gif', array('fullPath' => true));
$result = $this->Html->image('test.gif', array('fullBase' => true));
$here = $this->Html->url('/', true);
$this->assertTags($result, array('img' => array('src' => $here . 'img/test.gif', 'alt' => '')));
}

View file

@ -739,8 +739,9 @@ class HtmlHelper extends AppHelper {
/**
* Creates a formatted IMG element. If `$options['url']` is provided, an image link will be
* generated with the link pointed at `$options['url']`. This method will set an empty
* alt attribute if one is not supplied.
* generated with the link pointed at `$options['url']`. If `$options['fullBase']` is provided,
* the src attribute will receive full address (non-relative url) of the image file.
* This method will set an empty alt attribute if one is not supplied.
*
* ### Usage
*
@ -767,9 +768,9 @@ class HtmlHelper extends AppHelper {
$path = $this->assetTimestamp($this->webroot($path));
}
if(!empty($options['fullPath'])) {
if (!empty($options['fullBase'])) {
$path = $this->url('/', true) . $path;
unset($options['fullPath']);
unset($options['fullBase']);
}
if (!isset($options['alt'])) {