Changeset View
Changeset View
Standalone View
Standalone View
core/units/themes/theme_item.php
Context not available. | |||||
return $res; | return $res; | ||||
} | } | ||||
} | |||||
No newline at end of file | /** | ||||
* Returns full path to stylesheet file. | |||||
* | |||||
* @param boolean $as_url Allows to return url to stylesheet file instead of it's path. | |||||
* | |||||
* @return string|boolean | |||||
*/ | |||||
public function getStylesheetFile($as_url = false) | |||||
{ | |||||
$stylesheet_file = ltrim($this->GetDBField('StylesheetFile') ?: 'inc/style.css', '/'); | |||||
$theme_path = FULL_PATH . '/themes/' . $this->GetDBField('Name'); | |||||
$stylesheet_file = $theme_path . '/' . $stylesheet_file; | |||||
if ( !file_exists($stylesheet_file) ) { | |||||
return false; | |||||
} | |||||
if ( $as_url ) { | |||||
/** @var FileHelper $file_helper */ | |||||
$file_helper = $this->Application->recallObject('FileHelper'); | |||||
return $file_helper->pathToUrl($stylesheet_file); | |||||
} | |||||
return $stylesheet_file; | |||||
} | |||||
} | |||||
Context not available. |