Extract Google font import to a head string, make overideable

Allowing headStrings to be named is a bit of a stopgap solution. Really ClientView needs to be given much more power with headStrings and footStrings as separate objects, similar to the ItemList in the JS app.
This commit is contained in:
Toby Zerner 2016-01-12 18:29:21 +10:30
parent 98ea4d1e71
commit 94a62293eb
2 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,3 @@
@import url(//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700,600);
@import "font-awesome.less"; @import "font-awesome.less";
@fa-font-path: "../../assets/fonts"; @fa-font-path: "../../assets/fonts";

View File

@ -127,6 +127,8 @@ class ClientView implements Renderable
$this->assets = $assets; $this->assets = $assets;
$this->layout = $layout; $this->layout = $layout;
$this->localeJs = $localeJs; $this->localeJs = $localeJs;
$this->addHeadString('<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700,600">', 'font');
} }
/** /**
@ -164,9 +166,13 @@ class ClientView implements Renderable
* *
* @param string $string * @param string $string
*/ */
public function addHeadString($string) public function addHeadString($string, $name = null)
{ {
$this->headStrings[] = $string; if ($name) {
$this->headStrings[$name] = $string;
} else {
$this->headStrings[] = $string;
}
} }
/** /**