1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-08 07:36:32 +02:00

Issue #3104 - Library CSS order fix.

This commit is contained in:
Cameron
2018-05-11 17:39:26 -07:00
parent bf9cf05b0e
commit 6b925a6f76
4 changed files with 33 additions and 4 deletions

View File

@@ -172,6 +172,7 @@ echo "<title>".(defined('e_PAGETITLE') ? e_PAGETITLE.' - ' : (defined('PAGE_NAME
// D: Register CSS // D: Register CSS
// //
$e_js = e107::getJs(); $e_js = e107::getJs();
$e_pref = e107::getConfig('core'); $e_pref = e107::getConfig('core');
// Other Meta tags. // Other Meta tags.
@@ -315,7 +316,7 @@ else
$CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('other','core','plugin','theme','inline'); $CSSORDER = deftrue('CSSORDER') ? explode(",",CSSORDER) : array('library', 'other','core','plugin','theme','inline');
foreach($CSSORDER as $val) foreach($CSSORDER as $val)

View File

@@ -358,6 +358,21 @@ class e_jsmanager
return $this; return $this;
} }
/**
* Add CSS file(s) for inclusion in site header in the 'library' category.
*
* @param string|array $file_path path, shortcodes usage is prefered
* @param string $media any valid media attribute string - http://www.w3schools.com/TAGS/att_link_media.asp
* @return e_jsmanager
*/
public function libraryCSS($file_path, $media = 'all', $preComment = '', $postComment = '')
{
$this->addJs('library_css', $file_path, $media, $preComment, $postComment);
return $this;
}
/** /**
* Add CSS file(s) for inclusion in site header * Add CSS file(s) for inclusion in site header
* *
@@ -962,6 +977,13 @@ class e_jsmanager
$runtime = true; $runtime = true;
break; break;
case 'library_css':
$file_path = $runtime_location.$this->_sep.$tp->createConstants($file_path, 'mix').$this->_sep.$pre.$this->_sep.$post;
if(!isset($this->_e_css['library'])) $this->_e_css['library'] = array();
$registry = &$this->_e_css['library'];
$runtime = true;
break;
case 'inline_css': // no zones, TODO - media? case 'inline_css': // no zones, TODO - media?
$this->_e_css_src[] = $file_path; $this->_e_css_src[] = $file_path;
return $this; return $this;
@@ -1129,6 +1151,11 @@ class e_jsmanager
unset($this->_e_css['other']); unset($this->_e_css['other']);
break; break;
case 'library_css':
$this->renderFile(varset($this->_e_css['library'], array()), $external, 'Library CSS', $mod, false);
unset($this->_e_css['library']);
break;
case 'inline_css': case 'inline_css':
$this->renderInline($this->_e_css_src, 'Inline CSS', 'css'); $this->renderInline($this->_e_css_src, 'Inline CSS', 'css');
$this->_e_css_src = array(); $this->_e_css_src = array();

View File

@@ -300,7 +300,7 @@ class core_library
), ),
'css' => array( 'css' => array(
'dist/css/bootstrap.min.css' => array( 'dist/css/bootstrap.min.css' => array(
'zone' => 2, 'zone' => 1,
), ),
), ),
), ),
@@ -1724,7 +1724,8 @@ class e_library_manager
} }
elseif($type == 'css') elseif($type == 'css')
{ {
e107::css($options['type'], $data, null); e107::getJs()->libraryCSS($data); // load before others.
// e107::css($options['type'], $data, null);
} }
$count++; $count++;
} }

View File

@@ -7,7 +7,7 @@ if ( ! defined('e107_INIT')) { exit(); }
e107::meta('viewport', 'width=device-width, initial-scale=1.0'); e107::meta('viewport', 'width=device-width, initial-scale=1.0');
//e107::meta('apple-mobile-web-app-capable','yes'); //e107::meta('apple-mobile-web-app-capable','yes');
e107::css("url", "https://bootswatch.com/4/slate/bootstrap.min.css" );
$HEADER = array(); $HEADER = array();
$FOOTER = array(); $FOOTER = array();