Perforce Chronicle 2012.2/486814
API Documentation
|
Themes are collections of views, layouts, helpers, scripts, styles and image files. More...
Public Member Functions | |
getDoctype () | |
Get the doctype for this theme or the default if none has been specified. | |
getLayoutsPath () | |
Get the path to this theme's layouts. | |
getViewsPath () | |
Get the path to this theme's views. | |
load () | |
Load the theme into the environment. | |
Static Public Member Functions | |
static | fetchActive () |
Fetch the active (currently loaded) theme. | |
static | fetchDefault () |
Fetch the default theme. | |
static | hasActive () |
Determine if there is an active (currently loaded) theme. | |
static | reset () |
Clear any package paths and active theme. | |
Public Attributes | |
const | DEFAULT_DOCTYPE = 'XHTML1_STRICT' |
const | DEFAULT_THEME = 'default' |
const | PACKAGE_FILENAME = 'theme.ini' |
Static Protected Attributes | |
static | $_activeTheme = null |
static | $_fields |
static | $_idField = 'name' |
static | $_packagesPaths = array() |
Themes are collections of views, layouts, helpers, scripts, styles and image files.
Theme models are read-only.
static P4Cms_Theme::fetchActive | ( | ) | [static] |
Fetch the active (currently loaded) theme.
Guaranteed to return the active theme model or throw an exception.
P4Cms_Theme_Exception | if there is no currently active theme. |
{ if (!static::$_activeTheme || !static::$_activeTheme instanceof P4Cms_Theme) { throw new P4Cms_Theme_Exception("There is no active (currently loaded) theme."); } return static::$_activeTheme; }
static P4Cms_Theme::fetchDefault | ( | ) | [static] |
Fetch the default theme.
Guaranteed to return the default theme model or throw an exception.
P4Cms_Model_NotFoundException | if the default theme can't be fetched. |
{ return static::fetch(static::DEFAULT_THEME); }
P4Cms_Theme::getDoctype | ( | ) |
Get the doctype for this theme or the default if none has been specified.
Defaults to: 'XHTML1_STRICT'.
{ $info = $this->getPackageInfo(); return isset($info['doctype']) ? (string) $info['doctype'] : self::DEFAULT_DOCTYPE; }
P4Cms_Theme::getLayoutsPath | ( | ) |
Get the path to this theme's layouts.
{ return $this->getPath() . "/layouts"; }
P4Cms_Theme::getViewsPath | ( | ) |
Get the path to this theme's views.
{ return $this->getPath() . "/views"; }
static P4Cms_Theme::hasActive | ( | ) | [static] |
Determine if there is an active (currently loaded) theme.
{ try { static::fetchActive(); return true; } catch (P4Cms_Theme_Exception $e) { return false; } }
P4Cms_Theme::load | ( | ) |
Load the theme into the environment.
Set the theme in the ViewRenderer. Add the path to the theme's helpers. Add stylesheets and javascripts to the view. Load any required dojo modules. Register any provided dojo modules.
{ // set this instance as the active theme. static::$_activeTheme = $this; $view = static::getView(); // add the current theme's helpers path to the view. $view->addHelperPath($this->getPath() . '/helpers', 'Theme_Helper_'); // add theme's layout scripts path. $view->addScriptPath($this->getLayoutsPath()); // add theme's views path to the view $view->addScriptPath($this->getViewsPath()); // set the (x)html document type. $view->doctype($this->getDoctype()); // add theme meta, stylesheets and scripts to view. $this->_loadHtmlMeta(); $this->_loadStylesheets(); $this->_loadScripts(); // load dojo components. $this->_loadDojo(); }
static P4Cms_Theme::reset | ( | ) | [static] |
Clear any package paths and active theme.
Primarily used for testing.
{ static::clearPackagesPaths(); static::$_activeTheme = null; }
P4Cms_Theme::$_activeTheme = null [static, protected] |
P4Cms_Theme::$_fields [static, protected] |
array( 'name' => array( 'accessor' => 'getName', 'mutator' => 'setName' ), 'label' => array( 'accessor' => 'getLabel', 'readOnly' => true ), 'version' => array( 'accessor' => 'getVersion', 'readOnly' => true ), 'description' => array( 'accessor' => 'getDescription', 'readOnly' => true ), 'maintainerInfo' => array( 'accessor' => 'getMaintainerInfo', 'readOnly' => true ), 'tags' => array( 'accessor' => 'getTags', 'readOnly' => true ) )
Reimplemented from P4Cms_Model.
P4Cms_Theme::$_idField = 'name' [static, protected] |
Reimplemented from P4Cms_Model.
P4Cms_Theme::$_packagesPaths = array() [static, protected] |
Reimplemented from P4Cms_PackageAbstract.
const P4Cms_Theme::DEFAULT_DOCTYPE = 'XHTML1_STRICT' |
const P4Cms_Theme::DEFAULT_THEME = 'default' |
const P4Cms_Theme::PACKAGE_FILENAME = 'theme.ini' |
Reimplemented from P4Cms_PackageAbstract.