class PageTheme extends Theme (View source)

Constants

E_THEME_INSTALLED

THEME_EXTENSION

THEME_CUSTOMIZABLE_STYLESHEET_EXTENSION

FILENAME_TYPOGRAPHY_CSS

Properties

$error from  ConcreteObject
protected $pThemeName from  Theme
protected $pThemeID from  Theme
protected $pThemeDescription from  Theme
protected $pThemeDirectory from  Theme
protected $pThemeThumbnail from  Theme
protected $pThemeHandle from  Theme
protected $pThemeURL from  Theme
protected $pThemeIsPreview from  Theme
protected $pkgID from  Theme
protected $stylesheetCachePath from  Theme
protected $stylesheetCacheRelativePath from  Theme
protected $pThemeGridFrameworkHandle

Methods

loadError($error)

No description

isError()

No description

getError()

No description

setPropertiesFromArray($arr)

No description

static 
camelcase($file)

No description

static 
uncamelcase($string)

No description

__construct()

No description

from  Theme
static Theme[]
getGlobalList()

Get the installed themes provided by packages.

from  Theme
static Theme[]
getLocalList()

Get the installed themes provided by the core.

from  Theme
static Theme[]
getListByPackage($pkg)

Get the installed themes provided by a package.

from  Theme
static Theme[]
getList(string|null $where = null)

Get the installed themes.

from  Theme
static string[]
getInstalledHandles()

Get the handles of all the installed themes.

from  Theme
providesAsset(string $assetType, string|false $assetHandle = null)

Mark an asset as provided by this theme.

from  Theme
requireAsset()

Mark an asset as reuired by this theme.

from  Theme
static Theme[]
getAvailableThemes(bool $filterInstalled = true)

Get the all the themes available in the /application/themes directory.

from  Theme
static Theme|null
getByFileHandle(string $handle, string $dir = DIR_FILES_THEMES, string $pkgHandle = '')

Get a theme from the file system.

from  Theme
bool
isThemeCustomizable()

Checks the theme for a styles.xml file (which is how customizations happen).

from  Theme
getThemeCustomizableStyleList()

Gets the style list object for this theme.

from  Theme
Preset|null
getThemeCustomizablePreset($handle)

Get a preset for this theme by handle.

from  Theme
Preset[]
getThemeCustomizableStylePresets()

Get all presets available to this theme.

from  Theme
enablePreviewRequest()

Set this instance to be a preview for the current request.

from  Theme
resetThemeCustomStyles()

No description

from  Theme
bool
isThemePreviewRequest()

Is this instance a preview for the current request?

from  Theme
getThemeCustomizableStyleSheets()

Get all the customizable LESS stylesheets.

from  Theme
getStylesheetObject(string $stylesheet)

Get a customizable LESS stylesheet given the stylesheed base file name.

from  Theme
string
getStylesheet(string $stylesheet)

Look into the current CSS directory and return a fully compiled stylesheet when passed a LESS stylesheet.

from  Theme
getThemeCustomStyleObject()

Get a CustomStyle object for the theme if one exists.

from  Theme
ValueList|null
getThemeCustomStyleObjectValues()

Get the value list of the custom style object if one exists.

from  Theme
setCustomStyleObject(ValueList $valueList, Preset|null|false $selectedPreset = false, CustomCssRecord $customCssRecord = null)

Create a CustomStyle (and optionally a preset and the custom CSS) for this theme.

from  Theme
static Theme|null
getByHandle(string $pThemeHandle)

Get an installed theme given its handle.

from  Theme
static Theme|null
getByID(int $pThemeID)

Get an installed theme given its ID.

from  Theme
static Theme|null
populateThemeQuery(string $where, array $args)

Get the instance representing an installed theme.

from  Theme
static Theme|null
add(string $pThemeHandle, Package|Package|null $pkg = null)

Install a theme given its handle.

from  Theme
File[]
getFilesInTheme()

Grab all files in theme that are PHP based (or html if we go that route) and then lists them out, by type, allowing people to install them as page type, etc.

from  Theme
static stdClass
getThemeNameAndDescription(string $dir, string $pThemeHandle, string $pkgHandle = '')

Get the theme details by reading a directory containing the theme.

from  Theme
export(SimpleXMLElement $node)

Export this theme by creating the XML nodes under the provided XML node.

from  Theme
static 
exportList(SimpleXMLElement $xml)

Export all the installed themes by creating the XML nodes under the provided XML node.

from  Theme
static Theme|null
install(string $dir, string $pThemeHandle, int|null $pkgID)

Install a theme.

from  Theme
updateThemeCustomClass()

(Re)Scan the theme folder to check if it contains the page_theme.php file: if so, marks the theme as having a controller.

from  Theme
int|null
getThemeID()

Get the ID of the installed theme (if available).

from  Theme
string
getThemeName()

Get the (English) name of the theme.

from  Theme
string
getThemeDisplayName(string $format = 'html')

Get the localized name for this theme (escaped accordingly to $format).

from  Theme
int|null
getPackageID()

Get the ID of the package providing this theme (if available).

from  Theme
string|false|null
getPackageHandle()

Get the handle of the package providing this theme (if available).

from  Theme
hasCustomClass()

Returns whether a theme has a custom class.

from  Theme
string
getThemeHandle()

Get the handle of this theme.

from  Theme
string
getThemeDescription()

Get the (English) description of this theme.

from  Theme
string
getThemeDisplayDescription(string $format = 'html')

Get the localized description for this theme (escaped accordingly to $format).

from  Theme
string
getThemeDirectory()

Get the directory containing this theme.

from  Theme
string
getThemeURL()

Get the URL prefix of the assets provided by this theme.

from  Theme
string
getThemeEditorCSS()

Get the URL of the theme typography.css file.

from  Theme
setThemeURL(string $pThemeURL)

Set the URL prefix of the assets provided by this theme.

from  Theme
setThemeDirectory(string $pThemeDirectory)

Set the absolute path of the theme folder.

from  Theme
setThemeHandle(string $pThemeHandle)

Set the handle of this theme.

from  Theme
setStylesheetCachePath(string $path)

Set the absolute path of a directory where the CSS stylesheet files should be stored.

from  Theme
setStylesheetCacheRelativePath(string $path)

Set the path of a directory where the CSS stylesheet files should be stored, relative to the website root directory.

from  Theme
string
getStylesheetCachePath()

Get the absolute path of a directory where the CSS stylesheet files should be stored.

from  Theme
string
getStylesheetCacheRelativePath()

Get the path of a directory where the CSS stylesheet files should be stored, relative to the website root directory.

from  Theme
bool
isUninstallable()

Is this theme uninstallable?

from  Theme
Image
getThemeThumbnail()

Get the theme thumbnail image.

from  Theme
applyToSite(Site $site = null)

Apply this theme to all the pages of a site.

from  Theme
static Theme|null
getSiteTheme()

Get the theme for the current site.

from  Theme
uninstall()

Uninstall this theme.

from  Theme
registerAssets()

Register the assets provided by this theme.

from  Theme
bool
supportsGridFramework()

Does this theme support a grid framework?

from  Theme
getThemeGridFrameworkObject()

Get the grid framework supported by this theme.

from  Theme
array
getThemeBlockClasses()

Get the theme-specific CSS classes for every block.

array
getThemeAreaClasses()

Get the theme-specific CSS classes for every area.

from  Theme
array
getThemeEditorClasses()

Get the theme-specific style names to be used in the rich text editor.

from  Theme
array
getThemeDefaultBlockTemplates()

Get the theme-specific templates for every block.

from  Theme
array
getThemeResponsiveImageMap()

Get the handles of the thumbnail types and related resolution breakpoint.

from  Theme
getThemeGatheringGridItemMargin() deprecated

No description

from  Theme
getThemeGatheringGridItemWidth() deprecated

No description

from  Theme
getThemeGatheringGridItemHeight() deprecated

No description

from  Theme

Details

loadError($error)

No description

Parameters

$error

isError()

No description

getError()

No description

setPropertiesFromArray($arr)

No description

Parameters

$arr

static camelcase($file)

No description

Parameters

$file

static uncamelcase($string)

No description

Parameters

$string

__construct()

No description

static Theme[] getGlobalList()

Get the installed themes provided by packages.

Return Value

Theme[]

static Theme[] getLocalList()

Get the installed themes provided by the core.

Return Value

Theme[]

static Theme[] getListByPackage($pkg)

Get the installed themes provided by a package.

Parameters

$pkg

Return Value

Theme[]

static Theme[] getList(string|null $where = null)

Get the installed themes.

Parameters

string|null $where

a custom SQL criteria to filter the installed themes.

Return Value

Theme[]

static string[] getInstalledHandles()

Get the handles of all the installed themes.

Return Value

string[]

providesAsset(string $assetType, string|false $assetHandle = null)

Mark an asset as provided by this theme.

Parameters

string $assetType

E.g. 'css' or 'javascript' (or an asset group identifier like 'jquery/ui')

string|false $assetHandle

E.g. 'core/colorpicker'.

requireAsset()

Mark an asset as reuired by this theme.

Accepts the same arguments as \Concrete\Core\Http\ResponseAssetGroup::requireAsset().

static Theme[] getAvailableThemes(bool $filterInstalled = true)

Get the all the themes available in the /application/themes directory.

Parameters

bool $filterInstalled

true (default) to exclude the already installed themes, false to include them.

Return Value

Theme[]

static Theme|null getByFileHandle(string $handle, string $dir = DIR_FILES_THEMES, string $pkgHandle = '')

Get a theme from the file system.

Parameters

string $handle

the theme handle

string $dir

the parent directory that contains the theme directory

string $pkgHandle

the handle of the package providing the theme

Return Value

Theme|null

bool isThemeCustomizable()

Checks the theme for a styles.xml file (which is how customizations happen).

Return Value

bool

StyleList getThemeCustomizableStyleList()

Gets the style list object for this theme.

Return Value

StyleList

Preset|null getThemeCustomizablePreset($handle)

Get a preset for this theme by handle.

Parameters

$handle

Return Value

Preset|null

Preset[] getThemeCustomizableStylePresets()

Get all presets available to this theme.

Return Value

Preset[]

enablePreviewRequest()

Set this instance to be a preview for the current request.

resetThemeCustomStyles()

No description

bool isThemePreviewRequest()

Is this instance a preview for the current request?

Return Value

bool

Stylesheet[] getThemeCustomizableStyleSheets()

Get all the customizable LESS stylesheets.

Return Value

Stylesheet[]

Stylesheet getStylesheetObject(string $stylesheet)

Get a customizable LESS stylesheet given the stylesheed base file name.

Parameters

string $stylesheet

Return Value

Stylesheet

string getStylesheet(string $stylesheet)

Look into the current CSS directory and return a fully compiled stylesheet when passed a LESS stylesheet.

Also serves up custom value list values for the stylesheet if they exist.

Parameters

string $stylesheet

The LESS stylesheet to compile

Return Value

string

The path to the stylesheet

CustomStyle|null getThemeCustomStyleObject()

Get a CustomStyle object for the theme if one exists.

Return Value

CustomStyle|null

ValueList|null getThemeCustomStyleObjectValues()

Get the value list of the custom style object if one exists.

Return Value

ValueList|null

CustomStyle setCustomStyleObject(ValueList $valueList, Preset|null|false $selectedPreset = false, CustomCssRecord $customCssRecord = null)

Create a CustomStyle (and optionally a preset and the custom CSS) for this theme.

Parameters

ValueList $valueList
Preset|null|false $selectedPreset
CustomCssRecord $customCssRecord

Return Value

CustomStyle

static Theme|null getByHandle(string $pThemeHandle)

Get an installed theme given its handle.

Parameters

string $pThemeHandle

Return Value

Theme|null

static Theme|null getByID(int $pThemeID)

Get an installed theme given its ID.

Parameters

int $pThemeID

Return Value

Theme|null

static protected Theme|null populateThemeQuery(string $where, array $args)

Get the instance representing an installed theme.

Parameters

string $where

the SQL part used in the SELECT query

array $args

the parameters of the SQL query

Return Value

Theme|null

static Theme|null add(string $pThemeHandle, Package|Package|null $pkg = null)

Install a theme given its handle.

Parameters

string $pThemeHandle

the handle of the theme to be installed.

Package|Package|null $pkg

Return Value

Theme|null

returns NULL if the directory containing the theme could not be found

Exceptions

Exception

File[] getFilesInTheme()

Grab all files in theme that are PHP based (or html if we go that route) and then lists them out, by type, allowing people to install them as page type, etc.

..

Return Value

File[]

static private stdClass getThemeNameAndDescription(string $dir, string $pThemeHandle, string $pkgHandle = '')

Get the theme details by reading a directory containing the theme.

Parameters

string $dir
string $pThemeHandle
string $pkgHandle

Return Value

stdClass

export(SimpleXMLElement $node)

Export this theme by creating the XML nodes under the provided XML node.

Parameters

SimpleXMLElement $node

static exportList(SimpleXMLElement $xml)

Export all the installed themes by creating the XML nodes under the provided XML node.

Parameters

SimpleXMLElement $xml

static protected Theme|null install(string $dir, string $pThemeHandle, int|null $pkgID)

Install a theme.

Parameters

string $dir
string $pThemeHandle
int|null $pkgID

Return Value

Theme|null

returns NULL if $dir does not exist

Exceptions

Exception

updateThemeCustomClass()

(Re)Scan the theme folder to check if it contains the page_theme.php file: if so, marks the theme as having a controller.

int|null getThemeID()

Get the ID of the installed theme (if available).

Return Value

int|null

string getThemeName()

Get the (English) name of the theme.

Return Value

string

string getThemeDisplayName(string $format = 'html')

Get the localized name for this theme (escaped accordingly to $format).

Parameters

string $format

Escape the result in html format (if $format is 'html'); if $format is 'text' or any other value, the display name won't be escaped

Return Value

string

int|null getPackageID()

Get the ID of the package providing this theme (if available).

Return Value

int|null

string|false|null getPackageHandle()

Get the handle of the package providing this theme (if available).

Return Value

string|false|null

hasCustomClass()

Returns whether a theme has a custom class.

string getThemeHandle()

Get the handle of this theme.

Return Value

string

string getThemeDescription()

Get the (English) description of this theme.

Return Value

string

string getThemeDisplayDescription(string $format = 'html')

Get the localized description for this theme (escaped accordingly to $format).

Parameters

string $format

Escape the result in html format (if $format is 'html'); if $format is 'text' or any other value, the display name won't be escaped

Return Value

string

string getThemeDirectory()

Get the directory containing this theme.

Return Value

string

string getThemeURL()

Get the URL prefix of the assets provided by this theme.

Return Value

string

string getThemeEditorCSS()

Get the URL of the theme typography.css file.

Return Value

string

setThemeURL(string $pThemeURL)

Set the URL prefix of the assets provided by this theme.

Parameters

string $pThemeURL

setThemeDirectory(string $pThemeDirectory)

Set the absolute path of the theme folder.

Parameters

string $pThemeDirectory

setThemeHandle(string $pThemeHandle)

Set the handle of this theme.

Parameters

string $pThemeHandle

setStylesheetCachePath(string $path)

Set the absolute path of a directory where the CSS stylesheet files should be stored.

Parameters

string $path

setStylesheetCacheRelativePath(string $path)

Set the path of a directory where the CSS stylesheet files should be stored, relative to the website root directory.

Parameters

string $path

string getStylesheetCachePath()

Get the absolute path of a directory where the CSS stylesheet files should be stored.

Return Value

string

string getStylesheetCacheRelativePath()

Get the path of a directory where the CSS stylesheet files should be stored, relative to the website root directory.

Return Value

string

bool isUninstallable()

Is this theme uninstallable?

Return Value

bool

Image getThemeThumbnail()

Get the theme thumbnail image.

Return Value

Image

applyToSite(Site $site = null)

Apply this theme to all the pages of a site.

Parameters

Site $site

if null, we'll use the current site.

static Theme|null getSiteTheme()

Get the theme for the current site.

Return Value

Theme|null

uninstall()

Uninstall this theme.

registerAssets()

Register the assets provided by this theme.

bool supportsGridFramework()

Does this theme support a grid framework?

Return Value

bool

GridFramework|null getThemeGridFrameworkObject()

Get the grid framework supported by this theme.

Return Value

GridFramework|null

array getThemeBlockClasses()

Get the theme-specific CSS classes for every block.

Return Value

array

array keys are the block type handles, array values are a list of the CSS classes.

array getThemeAreaClasses()

Get the theme-specific CSS classes for every area.

Return Value

array

array keys are the area names, array values are a list of the CSS classes.

See also

PageTheme::getThemeAreaClasses for an example

array getThemeEditorClasses()

Get the theme-specific style names to be used in the rich text editor.

Return Value

array

Every array item is an array with the keys 'title', 'menuClass', 'spanClass', 'forceBlock'.

See also

PageTheme::getThemeEditorClasses for an example

array getThemeDefaultBlockTemplates()

Get the theme-specific templates for every block.

Return Value

array

array keys are the block type handles, array values are a list of the block templates.

See also

PageTheme::getThemeDefaultBlockTemplates for an example

array getThemeResponsiveImageMap()

Get the handles of the thumbnail types and related resolution breakpoint.

Return Value

array

See also

PageTheme::getThemeResponsiveImageMap for an example

getThemeGatheringGridItemMargin() deprecated

deprecated

No description

getThemeGatheringGridItemWidth() deprecated

deprecated

No description

getThemeGatheringGridItemHeight() deprecated

deprecated

No description