VuFind API Documentation

Initializer
in package

VuFind Theme Initializer

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

$config  : Config
Theme configuration object
$cookieManager  : CookieManager
Cookie manager
$event  : MvcEvent
Laminas MVC Event
$mobile  : Mobile
Mobile interface detector
$serviceManager  : ContainerInterface
Top-level service container
$themeInitialized  : bool
A static flag used to determine if the theme has been initialized
$tools  : ThemeInfo
Theme tools object
__construct()  : mixed
Constructor
init()  : void
Initialize the theme. This needs to be triggered as part of the dispatch event.
getThemeOptions()  : array<string|int, mixed>
Return an array of information about user-selectable themes. Each entry in the array is an associative array with 'name', 'desc' and 'selected' keys.
pickTheme()  : string
Support method for init() -- figure out which theme option is active.
sendThemeOptionsToView()  : void
Make the theme options available to the view.
setUpThemes()  : void
Support method for init() -- set up theme once current settings are known.
setUpThemeViewHelpers()  : void
Support method for setUpThemes -- register view helpers.
updateTranslator()  : void
Support method for setUpThemes() - add theme specific language files for translation.

Properties

$config

Theme configuration object

protected Config $config

$serviceManager

Top-level service container

protected ContainerInterface $serviceManager

$themeInitialized

A static flag used to determine if the theme has been initialized

protected static bool $themeInitialized = false

Methods

__construct()

Constructor

public __construct(Config $config, MvcEvent|ContainerInterface $eventOrContainer) : mixed
Parameters
$config : Config

Configuration object containing these keys:

  • theme - the name of the default theme for non-mobile devices
  • mobile_theme - the name of the default theme for mobile devices (omit to disable mobile support)
  • alternate_themes - a comma-separated list of alternate themes that can be accessed via the ui GET parameter; each entry is a colon-separated parameter-value:theme-name pair.
  • selectable_themes - a comma-separated list of themes that may be selected through the user interface; each entry is a colon-separated name:description pair, where name may be 'standard,' 'mobile,' or one of the parameter-values from the alternate_themes array.
  • generator - a Generator value to display in the HTML header (optional)
$eventOrContainer : MvcEvent|ContainerInterface

Laminas MVC Event object OR service container object

Return values
mixed

init()

Initialize the theme. This needs to be triggered as part of the dispatch event.

public init() : void
Tags
throws
Exception
Return values
void

getThemeOptions()

Return an array of information about user-selectable themes. Each entry in the array is an associative array with 'name', 'desc' and 'selected' keys.

protected getThemeOptions(string $currentTheme) : array<string|int, mixed>
Parameters
$currentTheme : string

Active theme

Return values
array<string|int, mixed>

pickTheme()

Support method for init() -- figure out which theme option is active.

protected pickTheme(RequestInterface $request) : string
Parameters
$request : RequestInterface

Request object (for obtaining user parameters); set to null if no request context is available.

Return values
string

sendThemeOptionsToView()

Make the theme options available to the view.

protected sendThemeOptionsToView(string $currentTheme) : void
Parameters
$currentTheme : string

Active theme

Return values
void

setUpThemes()

Support method for init() -- set up theme once current settings are known.

protected setUpThemes(array<string|int, mixed> $themes) : void
Parameters
$themes : array<string|int, mixed>

Theme configuration information.

Return values
void

setUpThemeViewHelpers()

Support method for setUpThemes -- register view helpers.

protected setUpThemeViewHelpers(array<string|int, mixed> $helpers) : void
Parameters
$helpers : array<string|int, mixed>

Helper settings

Return values
void

updateTranslator()

Support method for setUpThemes() - add theme specific language files for translation.

protected updateTranslator(array<string|int, mixed> $themes) : void
Parameters
$themes : array<string|int, mixed>

Theme configuration information.

Return values
void

Search results