Theme
class Theme extends ConcreteObject (View source)
A page's theme is a pointer to a directory containing templates, CSS files and optionally PHP includes, images and JavaScript files.
Themes inherit down the tree when a page is added, but can also be set at the site-wide level (thereby overriding any previous choices.).
Constants
E_THEME_INSTALLED |
|
THEME_EXTENSION |
|
THEME_CUSTOMIZABLE_STYLESHEET_EXTENSION |
|
FILENAME_TYPOGRAPHY_CSS |
|
Properties
$error | from ConcreteObject | ||
protected | $pThemeName | ||
protected | $pThemeID | ||
protected | $pThemeDescription | ||
protected | $pThemeDirectory | ||
protected | $pThemeThumbnail | ||
protected | $pThemeHandle | ||
protected | $pThemeURL | ||
protected | $pThemeIsPreview | ||
protected | $pkgID | ||
protected | $stylesheetCachePath | ||
protected | $stylesheetCacheRelativePath | ||
protected string|null|false | $pThemeGridFrameworkHandle | The handle of the grid framework supported by this theme. |
Methods
No description
Get the installed themes provided by packages.
Get the installed themes provided by the core.
Get the installed themes provided by a package.
Get the handles of all the installed themes.
Mark an asset as provided by this theme.
Mark an asset as reuired by this theme.
Get the all the themes available in the /application/themes directory.
Get a theme from the file system.
Checks the theme for a styles.xml file (which is how customizations happen).
Gets the style list object for this theme.
Get a preset for this theme by handle.
Get all presets available to this theme.
Set this instance to be a preview for the current request.
No description
Is this instance a preview for the current request?
Get all the customizable LESS stylesheets.
Get a customizable LESS stylesheet given the stylesheed base file name.
Look into the current CSS directory and return a fully compiled stylesheet when passed a LESS stylesheet.
Get a CustomStyle object for the theme if one exists.
Get the value list of the custom style object if one exists.
Create a CustomStyle (and optionally a preset and the custom CSS) for this theme.
Get an installed theme given its handle.
Get the instance representing an installed theme.
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.
Get the theme details by reading a directory containing the theme.
Export this theme by creating the XML nodes under the provided XML node.
Export all the installed themes by creating the XML nodes under the provided XML node.
(Re)Scan the theme folder to check if it contains the page_theme.php file: if so, marks the theme as having a controller.
Get the ID of the installed theme (if available).
Get the (English) name of the theme.
Get the localized name for this theme (escaped accordingly to $format).
Get the ID of the package providing this theme (if available).
Get the handle of the package providing this theme (if available).
Returns whether a theme has a custom class.
Get the handle of this theme.
Get the (English) description of this theme.
Get the localized description for this theme (escaped accordingly to $format).
Get the directory containing this theme.
Get the URL prefix of the assets provided by this theme.
Get the URL of the theme typography.css file.
Set the URL prefix of the assets provided by this theme.
Set the absolute path of the theme folder.
Set the handle of this theme.
Set the absolute path of a directory where the CSS stylesheet files should be stored.
Set the path of a directory where the CSS stylesheet files should be stored, relative to the website root directory.
Get the absolute path of a directory where the CSS stylesheet files should be stored.
Get the path of a directory where the CSS stylesheet files should be stored, relative to the website root directory.
Is this theme uninstallable?
Get the theme thumbnail image.
Get the theme for the current site.
Uninstall this theme.
Register the assets provided by this theme.
Does this theme support a grid framework?
Get the grid framework supported by this theme.
Get the theme-specific CSS classes for every block.
Get the theme-specific CSS classes for every area.
Get the theme-specific style names to be used in the rich text editor.
Get the theme-specific templates for every block.
Get the handles of the thumbnail types and related resolution breakpoint.
Details
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
static Theme[]
getGlobalList()
Get the installed themes provided by packages.
static Theme[]
getLocalList()
Get the installed themes provided by the core.
static Theme[]
getListByPackage($pkg)
Get the installed themes provided by a package.
static Theme[]
getList(string|null $where = null)
Get the installed themes.
static string[]
getInstalledHandles()
Get the handles of all the installed themes.
providesAsset(string $assetType, string|false $assetHandle = null)
Mark an asset as provided by this theme.
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.
static Theme|null
getByFileHandle(string $handle, string $dir = DIR_FILES_THEMES, string $pkgHandle = '')
Get a theme from the file system.
bool
isThemeCustomizable()
Checks the theme for a styles.xml file (which is how customizations happen).
StyleList
getThemeCustomizableStyleList()
Gets the style list object for this theme.
Preset|null
getThemeCustomizablePreset($handle)
Get a preset for this theme by handle.
Preset[]
getThemeCustomizableStylePresets()
Get all presets available to this theme.
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?
Stylesheet[]
getThemeCustomizableStyleSheets()
Get all the customizable LESS stylesheets.
Stylesheet
getStylesheetObject(string $stylesheet)
Get a customizable LESS stylesheet given the stylesheed base file name.
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.
CustomStyle|null
getThemeCustomStyleObject()
Get a CustomStyle object for the theme if one exists.
ValueList|null
getThemeCustomStyleObjectValues()
Get the value list of the custom style object if one exists.
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.
static Theme|null
getByHandle(string $pThemeHandle)
Get an installed theme given its handle.
static Theme|null
getByID(int $pThemeID)
Get an installed theme given its ID.
static protected Theme|null
populateThemeQuery(string $where, array $args)
Get the instance representing an installed theme.
static Theme|null
add(string $pThemeHandle, Package|Package|null $pkg = null)
Install a theme given its handle.
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.
..
static private stdClass
getThemeNameAndDescription(string $dir, string $pThemeHandle, string $pkgHandle = '')
Get the theme details by reading a directory containing the theme.
export(SimpleXMLElement $node)
Export this theme by creating the XML nodes under the provided XML node.
static
exportList(SimpleXMLElement $xml)
Export all the installed themes by creating the XML nodes under the provided XML node.
static protected Theme|null
install(string $dir, string $pThemeHandle, int|null $pkgID)
Install a 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.
int|null
getThemeID()
Get the ID of the installed theme (if available).
string
getThemeName()
Get the (English) name of the theme.
string
getThemeDisplayName(string $format = 'html')
Get the localized name for this theme (escaped accordingly to $format).
int|null
getPackageID()
Get the ID of the package providing this theme (if available).
string|false|null
getPackageHandle()
Get the handle of the package providing this theme (if available).
hasCustomClass()
Returns whether a theme has a custom class.
string
getThemeHandle()
Get the handle of this theme.
string
getThemeDescription()
Get the (English) description of this theme.
string
getThemeDisplayDescription(string $format = 'html')
Get the localized description for this theme (escaped accordingly to $format).
string
getThemeDirectory()
Get the directory containing this theme.
string
getThemeURL()
Get the URL prefix of the assets provided by this theme.
string
getThemeEditorCSS()
Get the URL of the theme typography.css file.
setThemeURL(string $pThemeURL)
Set the URL prefix of the assets provided by this theme.
setThemeDirectory(string $pThemeDirectory)
Set the absolute path of the theme folder.
setThemeHandle(string $pThemeHandle)
Set the handle of this theme.
setStylesheetCachePath(string $path)
Set the absolute path of a directory where the CSS stylesheet files should be stored.
setStylesheetCacheRelativePath(string $path)
Set the path of a directory where the CSS stylesheet files should be stored, relative to the website root directory.
string
getStylesheetCachePath()
Get the absolute path of a directory where the CSS stylesheet files should be stored.
string
getStylesheetCacheRelativePath()
Get the path of a directory where the CSS stylesheet files should be stored, relative to the website root directory.
bool
isUninstallable()
Is this theme uninstallable?
Image
getThemeThumbnail()
Get the theme thumbnail image.
applyToSite(Site $site = null)
Apply this theme to all the pages of a site.
static Theme|null
getSiteTheme()
Get the theme for the current site.
uninstall()
Uninstall this theme.
registerAssets()
Register the assets provided by this theme.
bool
supportsGridFramework()
Does this theme support a grid framework?
GridFramework|null
getThemeGridFrameworkObject()
Get the grid framework supported by this theme.
array
getThemeBlockClasses()
Get the theme-specific CSS classes for every block.
array
getThemeAreaClasses()
Get the theme-specific CSS classes for every area.
array
getThemeEditorClasses()
Get the theme-specific style names to be used in the rich text editor.
array
getThemeDefaultBlockTemplates()
Get the theme-specific templates for every block.
array
getThemeResponsiveImageMap()
Get the handles of the thumbnail types and related resolution breakpoint.
getThemeGatheringGridItemMargin()
deprecated
deprecated
No description
getThemeGatheringGridItemWidth()
deprecated
deprecated
No description
getThemeGatheringGridItemHeight()
deprecated
deprecated
No description