mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Option to return img src with fullpath address
This commit is contained in:
parent
339259c841
commit
0c0135ff5e
2 changed files with 9 additions and 0 deletions
|
@ -351,6 +351,10 @@ 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));
|
||||
$here = $this->Html->url('/', true);
|
||||
$this->assertTags($result, array('img' => array('src' => $here . 'img/test.gif', 'alt' => '')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -707,6 +707,11 @@ class HtmlHelper extends AppHelper {
|
|||
$path = $this->assetTimestamp($this->webroot($path));
|
||||
}
|
||||
|
||||
if(!empty($options['fullPath'])) {
|
||||
$path = $this->url('/', true) . $path;
|
||||
unset($options['fullPath']);
|
||||
}
|
||||
|
||||
if (!isset($options['alt'])) {
|
||||
$options['alt'] = '';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue