Compare commits

...
7 Commits
Author SHA1 Message Date
Tom 4edbd282ba Merge pull request #26 from toniperic/patch-1
Add support for Favicon files
2015-05-06 07:18:34 -07:00
Tom 3166c19203 Merge pull request #34 from garygreen/fix-docblocks
Fix some docblock returns
2015-05-06 07:17:50 -07:00
Gary daae1062da Fix some docblock returns 2015-04-25 13:19:56 +01:00
Tom 55eb889aca Update readme.md 2015-04-23 07:38:50 -07:00
Toni Perić 52e297e679 Newline at the end of the file 2015-04-07 22:06:26 +02:00
Toni Perić c3a3a44a37 Added test 2015-04-07 21:43:57 +02:00
Toni Perić 19860865d1 Update HtmlBuilder.php
Add support for Favicon files.
2015-04-07 20:45:59 +02:00
4 changed files with 33 additions and 5 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
# Forms & HTML
[![Build Status](https://travis-ci.org/LaravelCollective/html.svg)](https://travis-ci.org/LaravelCollective/html)
[![Total Downloads](https://poser.pugx.org/LaravelCollective/html/downloads.svg)](https://packagist.org/packages/laravelcollective/html)
[![Total Downloads](https://poser.pugx.org/LaravelCollective/html/downloads)](https://packagist.org/packages/laravelcollective/html)
[![Latest Stable Version](https://poser.pugx.org/LaravelCollective/html/v/stable.svg)](https://packagist.org/packages/laravelcollective/html)
[![Latest Unstable Version](https://poser.pugx.org/LaravelCollective/html/v/unstable.svg)](https://packagist.org/packages/laravelcollective/html)
[![License](https://poser.pugx.org/LaravelCollective/html/license.svg)](https://packagist.org/packages/laravelcollective/html)
+4 -4
View File
@@ -575,7 +575,7 @@ class FormBuilder {
*
* @param string $value
* @param string $selected
* @return string
* @return string|null
*/
protected function getSelectedValue($value, $selected)
{
@@ -908,7 +908,7 @@ class FormBuilder {
*
* @param string $name
* @param string $value
* @return string
* @return mixed
*/
public function getValueAttribute($name, $value = null)
{
@@ -931,7 +931,7 @@ class FormBuilder {
* Get the model value that should be assigned to the field.
*
* @param string $name
* @return string
* @return mixed
*/
protected function getModelValueAttribute($name)
{
@@ -949,7 +949,7 @@ class FormBuilder {
* Get a value from the session's old input.
*
* @param string $name
* @return string
* @return mixed
*/
public function old($name)
{
+19
View File
@@ -97,6 +97,25 @@ class HtmlBuilder {
return '<img src="'.$this->url->asset($url, $secure).'"'.$this->attributes($attributes).'>';
}
/**
* Generate a link to a Favicon file.
*
* @param string $url
* @param array $attributes
* @param bool $secure
* @return string
*/
public function favicon($url, $attributes = array(), $secure = null)
{
$defaults = array('rel' => 'shortcut icon', 'type' => 'image/x-icon');
$attributes = $attributes + $defaults;
$attributes['href'] = $this->url->asset($url, $secure);
return '<link'.$this->attributes($attributes).'>'.PHP_EOL;
}
/**
* Generate a HTML link.
*
+9
View File
@@ -55,4 +55,13 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('<meta content="website" property="og:type">'.PHP_EOL, $result);
}
public function testFavicon()
{
$this->urlGenerator->forceRootUrl('http://foo.com');
$target = $this->urlGenerator->to('bar.ico');
$result = $this->htmlBuilder->favicon('http://foo.com/bar.ico');
$this->assertEquals('<link rel="shortcut icon" type="image/x-icon" href="'.$target.'">' . PHP_EOL, $result);
}
}