VuFind API Documentation

ThemeInfo
in package
Uses MergeRecursiveTrait

Class to represent currently-selected theme and related information.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Site

Table of Contents

RETURN_ALL_DETAILS  = 'all'
$allThemeInfo  : array<string|int, mixed>
Theme configuration cache
$baseDir  : string
Base directory for theme files
$cache  : StorageInterface
Cache for merged configs
$currentTheme  : string
Current selected theme
$safeTheme  : string
A safe theme (guaranteed to exist) that can be loaded if an invalid configuration is passed in
__construct()  : mixed
Constructor
findContainingTheme()  : string|array<string|int, mixed>|null
Search the themes for a particular file. If it exists, return the first matching theme name; otherwise, return null.
findInThemes()  : array<string|int, mixed>
Search the themes for a file pattern. Returns all matching files.
getBaseDir()  : string
Get the base directory for themes.
getMergedConfig()  : array<string|int, mixed>|string
Get a configuration element, merged to reflect theme inheritance.
getTheme()  : string
Get the current theme.
getThemeInfo()  : array<string|int, mixed>
Get all the configuration details related to the current theme.
setCache()  : void
Provide cache and activate info caching
setTheme()  : void
Set the current theme.
getMixinConfig()  : string
Get the configuration file for the specified mixin.
getThemeConfig()  : string
Get the configuration file for the specified theme.
isStringKeyedArray()  : bool
Determine if a variable is a string-keyed array
loadThemeConfig()  : void
Load configuration for the specified theme (and its mixins, if any) into the allThemeInfo property.
mergeRecursive()  : array<string|int, mixed>|string
Merge array recursive without combining single values to a new array as php's array_merge_recursive function does.

Constants

RETURN_ALL_DETAILS

public mixed RETURN_ALL_DETAILS = 'all'

Properties

$allThemeInfo

Theme configuration cache

protected array<string|int, mixed> $allThemeInfo = null

$baseDir

Base directory for theme files

protected string $baseDir

$cache

Cache for merged configs

protected StorageInterface $cache = null

$currentTheme

Current selected theme

protected string $currentTheme

$safeTheme

A safe theme (guaranteed to exist) that can be loaded if an invalid configuration is passed in

protected string $safeTheme

Methods

__construct()

Constructor

public __construct(string $baseDir, string $safeTheme) : mixed
Parameters
$baseDir : string

Base directory for theme files.

$safeTheme : string

Theme that should be guaranteed to exist.

Return values
mixed

findContainingTheme()

Search the themes for a particular file. If it exists, return the first matching theme name; otherwise, return null.

public findContainingTheme(string|array<string|int, mixed> $relativePath[, string|bool $returnType = false ]) : string|array<string|int, mixed>|null
Parameters
$relativePath : string|array<string|int, mixed>

Relative path (or array of paths) to search within themes

$returnType : string|bool = false

If boolean true, return full file path; if boolean false, return containing theme name; if self::RETURN_ALL_DETAILS, return an array containing both values (keyed with 'path', 'theme' and 'relativePath').

Return values
string|array<string|int, mixed>|null

findInThemes()

Search the themes for a file pattern. Returns all matching files.

public findInThemes(string|array<string|int, mixed> $relativePathPattern) : array<string|int, mixed>

Note that for any matching file the last match in the theme hierarchy is returned.

Parameters
$relativePathPattern : string|array<string|int, mixed>

Relative path pattern (or array of patterns) to search within themes

Return values
array<string|int, mixed>

getBaseDir()

Get the base directory for themes.

public getBaseDir() : string
Return values
string

getMergedConfig()

Get a configuration element, merged to reflect theme inheritance.

public getMergedConfig([string $key = '' ]) : array<string|int, mixed>|string
Parameters
$key : string = ''

Configuration key to retrieve (or empty string to retrieve full configuration)

Return values
array<string|int, mixed>|string

getTheme()

Get the current theme.

public getTheme() : string
Return values
string

getThemeInfo()

Get all the configuration details related to the current theme.

public getThemeInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

setCache()

Provide cache and activate info caching

public setCache(StorageInterface $cache) : void
Parameters
$cache : StorageInterface

cache object

Return values
void

setTheme()

Set the current theme.

public setTheme(string $theme) : void
Parameters
$theme : string

Theme to set.

Tags
throws
Exception
Return values
void

getMixinConfig()

Get the configuration file for the specified mixin.

protected getMixinConfig(string $mixin) : string
Parameters
$mixin : string

Mixin name

Return values
string

getThemeConfig()

Get the configuration file for the specified theme.

protected getThemeConfig(string $theme) : string
Parameters
$theme : string

Theme name

Return values
string

isStringKeyedArray()

Determine if a variable is a string-keyed array

protected isStringKeyedArray(mixed $op) : bool
Parameters
$op : mixed

Variable to test

Return values
bool

loadThemeConfig()

Load configuration for the specified theme (and its mixins, if any) into the allThemeInfo property.

protected loadThemeConfig(string $theme) : void
Parameters
$theme : string

Name of theme to load

Return values
void

mergeRecursive()

Merge array recursive without combining single values to a new array as php's array_merge_recursive function does.

protected mergeRecursive(array<string|int, mixed>|string $val1, array<string|int, mixed>|string $val2) : array<string|int, mixed>|string
Parameters
$val1 : array<string|int, mixed>|string

First Value

$val2 : array<string|int, mixed>|string

Second Value

Return values
array<string|int, mixed>|string

merged values

Search results