mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Fixed wrong condition in Requirements::includeInHTML() which failed to process requirements if only customCSS() was used
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@71467 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
88720f07c5
commit
023e733b16
@ -534,7 +534,7 @@ class Requirements_Backend {
|
||||
function includeInHTML($templateFile, $content) {
|
||||
if(isset($_GET['debug_profile'])) Profiler::mark("Requirements::includeInHTML");
|
||||
|
||||
if(strpos($content, '</head') !== false && ($this->javascript || $this->css || $this->customScript || $this->customHeadTags)) {
|
||||
if(strpos($content, '</head') !== false && ($this->javascript || $this->customCSS || $this->customScript || $this->customHeadTags)) {
|
||||
$requirements = '';
|
||||
$jsRequirements = '';
|
||||
|
||||
@ -566,6 +566,7 @@ class Requirements_Backend {
|
||||
$requirements .= "<link rel=\"stylesheet\" type=\"text/css\"{$media} href=\"$path\" />\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach(array_diff_key($this->customCSS, $this->blocked) as $css) {
|
||||
$requirements .= "<style type=\"text/css\">\n$css\n</style>\n";
|
||||
}
|
||||
|
@ -10,6 +10,17 @@ class RequirementsTest extends SapphireTest {
|
||||
|
||||
static $html_template = '<html><head></head><body></body></html>';
|
||||
|
||||
function testCustomCSS() {
|
||||
Requirements::customCSS(".testclass {color:#f00;}");
|
||||
|
||||
$html = Requirements::includeInHTML(false, self::$html_template);
|
||||
|
||||
$this->assertTrue(
|
||||
(strpos($html, '.testclass {color:#f00;}') !== false),
|
||||
'customCSS() shows up in template'
|
||||
);
|
||||
}
|
||||
|
||||
function testExternalUrls() {
|
||||
Requirements::javascript('http://www.mydomain.com/test.js');
|
||||
Requirements::javascript('https://www.mysecuredomain.com/test.js');
|
||||
|
Loading…
Reference in New Issue
Block a user