VuFind API Documentation

HeadLink extends HeadLink
in package
implements LoggerAwareInterface Uses ConcatTrait, RelativePathTrait, LoggerAwareTrait

Head link view helper (extended for VuFind's theme system)

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

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

link

Wiki

Interfaces, Classes, Traits and Enums

LoggerAwareInterface

Table of Contents

$concatIndex  : number
Future order of the concatenated file
$cspNonce  : string
CSP nonce
$groups  : array<string|int, mixed>
Array of resource items by type, contains key as well
$maxImportSize  : int|null
Maximum import size (for inlining of e.g. images) in kilobytes
$themeInfo  : ThemeInfo
Theme information service
$usePipeline  : bool
Should we use the asset pipeline to join files together and minify them?
__construct()  : mixed
Constructor
forcePrependStylesheet()  : void
Forcibly prepend a stylesheet removing it from any existing position
getIndent()  : void
getSeparator()  : void
getType()  : string
Get the file type
getWhitespace()  : void
itemToString()  : string
Create HTML link element from data item
toString()  : string
Render link elements as string Customized to minify and concatenate
addNonce()  : void
Add a content security policy nonce to the item
createConcatenatedFile()  : void
Create a concatenated file from the given group of files
debug()  : void
Log a debug message.
enabledInConfig()  : bool
Check if config is enabled for this file type
filterItems()  : bool
Initialize class properties related to concatenation of resources.
getConcatenatedFilePath()  : string
Using the concatKey, return the path of the concatenated file.
getFileType()  : string
Folder name and file extension for trait
getMinifiedData()  : string
Get minified data for a file
getMinifier()  : JS
Get the minifier that can handle these file types Required by ConcatTrait
getResourceCacheDir()  : string
Get the path to the directory where we can cache files generated by this trait. The directory will be created if it does not already exist.
getResourceFilePath()  : string
Get the file path from the link object Required by ConcatTrait
isExcludedFromConcat()  : bool
Returns true if file should not be included in the compressed concat file Required by ConcatTrait
isMinifiable()  : bool
Check if a file is minifiable i.e. does not have a pattern that denotes it's already minified
isPipelineActive()  : bool
Can we use the asset pipeline?
isRelativePath()  : bool
Is the provided src value a relative path? Returns true if this should be searched within the local theme, or false if it is an absolute path or full URL.
log()  : void
Send a message to the logger.
logError()  : void
Log an error message.
logWarning()  : void
Log a warning message.
outputInOrder()  : string
Process and return items in index order
setResourceFilePath()  : stdClass
Set the file path of the link object Required by ConcatTrait

Properties

$concatIndex

Future order of the concatenated file

protected number $concatIndex = null

$cspNonce

CSP nonce

protected string $cspNonce

$groups

Array of resource items by type, contains key as well

protected array<string|int, mixed> $groups = []

$maxImportSize

Maximum import size (for inlining of e.g. images) in kilobytes

protected int|null $maxImportSize

$usePipeline

Should we use the asset pipeline to join files together and minify them?

protected bool $usePipeline = false

Methods

__construct()

Constructor

public __construct(ThemeInfo $themeInfo[, string|bool $plconfig = false ][, string $nonce = '' ][, int $maxImportSize = null ]) : mixed
Parameters
$themeInfo : ThemeInfo

Theme information service

$plconfig : string|bool = false

Config for current application environment

$nonce : string = ''

Nonce from nonce generator

$maxImportSize : int = null

Maximum imported (inlined) file size

Return values
mixed

forcePrependStylesheet()

Forcibly prepend a stylesheet removing it from any existing position

public forcePrependStylesheet(string $href[, string $media = 'screen' ][, string $conditionalStylesheet = '' ][, array<string|int, mixed> $extras = [] ]) : void
Parameters
$href : string

Stylesheet href

$media : string = 'screen'

Media

$conditionalStylesheet : string = ''

Any conditions

$extras : array<string|int, mixed> = []

Array of extra attributes

Return values
void

getIndent()

public getIndent() : void
Return values
void

getSeparator()

public getSeparator() : void
Return values
void

getType()

Get the file type

public getType(stdClass $item) : string
Parameters
$item : stdClass

Link element object

Return values
string

getWhitespace()

public getWhitespace(string|int $indent) : void
Parameters
$indent : string|int
Return values
void

itemToString()

Create HTML link element from data item

public itemToString(stdClass $item) : string
Parameters
$item : stdClass

data item

Return values
string

toString()

Render link elements as string Customized to minify and concatenate

public toString([string|int $indent = null ]) : string
Parameters
$indent : string|int = null

Amount of whitespace or string to use for indention

Return values
string

addNonce()

Add a content security policy nonce to the item

protected addNonce(stdClass $item) : void
Parameters
$item : stdClass

Item

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
void

createConcatenatedFile()

Create a concatenated file from the given group of files

protected createConcatenatedFile(string $concatPath, array<string|int, mixed> $group) : void
Parameters
$concatPath : string

Resulting file path

$group : array<string|int, mixed>

Object containing 'key' and stdobj file 'items'

Tags
throws
Exception
Return values
void

debug()

Log a debug message.

protected debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

enabledInConfig()

Check if config is enabled for this file type

protected enabledInConfig(string|bool $config) : bool
Parameters
$config : string|bool

Config for current application environment

Return values
bool

filterItems()

Initialize class properties related to concatenation of resources.

protected filterItems() : bool

All of the elements to be concatenated into groups and and those that need to remain on their own special group 'other'.

Return values
bool

True if there are items

getConcatenatedFilePath()

Using the concatKey, return the path of the concatenated file.

protected getConcatenatedFilePath(array<string|int, mixed> $group) : string

Generate if it does not yet exist.

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

Object containing 'key' and stdobj file 'items'

Return values
string

getFileType()

Folder name and file extension for trait

protected getFileType() : string
Return values
string

getMinifiedData()

Get minified data for a file

protected getMinifiedData(array<string|int, mixed> $details, string $concatPath) : string
Parameters
$details : array<string|int, mixed>

File details

$concatPath : string

Target path for the resulting file (used in minifier for path mapping)

Tags
throws
Exception
Return values
string

getMinifier()

Get the minifier that can handle these file types Required by ConcatTrait

protected getMinifier() : JS
Return values
JS

getResourceCacheDir()

Get the path to the directory where we can cache files generated by this trait. The directory will be created if it does not already exist.

protected getResourceCacheDir() : string
Return values
string

getResourceFilePath()

Get the file path from the link object Required by ConcatTrait

protected getResourceFilePath(stdClass $item) : string
Parameters
$item : stdClass

Link element object

Return values
string

isExcludedFromConcat()

Returns true if file should not be included in the compressed concat file Required by ConcatTrait

protected isExcludedFromConcat(stdClass $item) : bool
Parameters
$item : stdClass

Link element object

Return values
bool

isMinifiable()

Check if a file is minifiable i.e. does not have a pattern that denotes it's already minified

protected isMinifiable(string $filename) : bool
Parameters
$filename : string

File name

Return values
bool

isPipelineActive()

Can we use the asset pipeline?

protected isPipelineActive() : bool
Return values
bool

isRelativePath()

Is the provided src value a relative path? Returns true if this should be searched within the local theme, or false if it is an absolute path or full URL.

protected isRelativePath(string $src) : bool
Parameters
$src : string

Value to check

Return values
bool

log()

Send a message to the logger.

protected log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
$level : string

Log level

$message : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = false

Prepend class name to message?

Return values
void

logError()

Log an error message.

protected logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

logWarning()

Log a warning message.

protected logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

outputInOrder()

Process and return items in index order

protected outputInOrder(string|int $indent) : string
Parameters
$indent : string|int

Amount of whitespace/string to use for indention

Return values
string

setResourceFilePath()

Set the file path of the link object Required by ConcatTrait

protected setResourceFilePath(stdClass $item, string $path) : stdClass
Parameters
$item : stdClass

Link element object

$path : string

New path string

Return values
stdClass

Search results