Theme
Package: Record
- class Theme
A theme and its metadata.
Unlike most other models, Themes are not stored in the database. This model relies only on INI data, but acts like an Omeka_Record_AbstractRecord model.
- constant THEME_IMAGE_FILE_NAME
Filename for the theme screenshot.
- constant THEME_INI_FILE_NAME
Filename for the theme INI file.
- constant THEME_CONFIG_FILE_NAME
Filename for the theme config form INI file.
- constant PUBLIC_THEME_OPTION
Option name for the current public theme.
- constant ADMIN_THEME_OPTION
Option name for the current admin theme.
- property path
string
Absolute path to the theme.
- property directory
string
Directory name of the theme.
- property image
string
Web path to the theme screenshot.
- property author
string
The theme’s author.
- property title
string
The theme’s title.
- property description
string
The theme’s description.
- property license
string
The software license for the theme.
- property website
string
A link to the theme’s website.
- property omeka_minimum_version
string
The minimum Omeka version the theme will run on.
- __construct($themeName)
Set the INI and file data for the theme, given its directory name.
- Parameters:
$themeName (
string
) – Directory name.
- setDirectoryName($dir)
Set the theme’s directory name and path.
- Parameters:
$dir (
string
) – Directory name.
- getScriptPath()
Get the physical path to the theme’s scripts.
- Returns:
string Physical path.
- getAssetPath()
Get the web path to the theme’s assets.
- Returns:
string Web path.
- getScriptPathForPlugin($pluginModuleName)
Get the physical path to the theme’s override scripts for the given plugin.
- Parameters:
$pluginModuleName (
string
) – (i.e., ‘exhibit-builder’)
- Returns:
string Physical path.
- getAssetPathForPlugin($pluginModuleName)
Get the web path to the theme’s override assets for the given plugin.
- Parameters:
$pluginModuleName (
string
) – (i.e., ‘exhibit-builder’)
- Returns:
string Web path.
- setImage($fileName)
Set the web path to the screenshot, if it exists.
- Parameters:
$fileName (
string
) – Relative filename of the image to check.
- setIni($fileName)
Load data from the INI file at the given path.
- Parameters:
$fileName (
string
) – Relative filename of the INI file.
- setConfig($fileName)
Check for a theme config file at the given location.
- Parameters:
$fileName (
string
) – Relative filename of the theme config.ini.
- getCurrentThemeName($type = null)
Get the directory name of the current theme.
- Parameters:
$type (
string
) – ‘admin’ or ‘public’, defaults to current type
- Returns:
string
- getAllThemes()
Retrieve all themes
- Returns:
array An array of theme objects
- getAllAdminThemes()
Retrieve all admin themes
- Returns:
array An array of theme objects
- getTheme($themeName)
Retrieve a theme.
- Parameters:
$themeName (
string
) – The name of the theme.
- Returns:
Theme A theme object
- setOptions($themeName, $themeConfigOptions)
Set theme configuration options.
- Parameters:
$themeName (
string
) – The name of the theme$themeConfigOptions (
array
) – An associative array of configuration options, where each key is a configuration form input name and each value is a string value of that configuration form input
- getOptions($themeName)
Get theme configuration options.
- Parameters:
$themeName (
string
) – The name of the theme
- Returns:
array An associative array of configuration options, where each key is a configuration form input name and each value is a string value of that configuration form input
- getOption($themeName, $themeOptionName)
Get the value of a theme configuration option.
- Parameters:
$themeName (
string
) – The name of the theme$themeOptionName (
string
) – The name of the theme option
- Returns:
string The value of the theme option
- setOption($themeName, $themeOptionName, $themeOptionValue)
Set the value of a theme configuration option.
- Parameters:
$themeName (
string
) – The name of the theme$themeOptionName (
string
) – The name of the theme option$themeOptionValue –
- getOptionName($themeName)
Get the name of a specific theme’s option. Each theme has a single option in the option’s table, which stores all of the configuration options for that theme
- Parameters:
$themeName (
string
) – The name of the theme
- Returns:
string The name of a specific theme’s option.
- getUploadedFileName($themeName, $optionName, $fileName)
Get the name of a file uploaded as a theme configuration option. This is the name of the file after it has been uploaded and renamed.
- Parameters:
$themeName (
string
) – The name of the theme$optionName (
string
) – The name of the theme option associated with the uploaded file$fileName (
string
) – The name of the uploaded file
- Returns:
string The name of an uploaded file for the theme.
- _parseWebsite($website)
Parses the website string to confirm whether it has a scheme.
- Parameters:
$website (
string
) – The website given in the theme’s INI file.
- Returns:
string The website URL with a prepended scheme.