VuFind API Documentation

Recommend extends AbstractHelper
in package
Uses ClassBasedTemplateRendererTrait

Recommendation module view helper

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

Table of Contents

$templateCache  : array<string|int, mixed>
Cache for found templates
__invoke()  : string
Render the output of a recommendation module.
getBriefClass()  : string
Helper to grab the end of the class name
getCachedClassTemplate()  : string
Resolve the class template file unless already cached and return the file name.
getTemplateWithClass()  : string
Helper to put the template path and class name together
renderClassTemplate()  : string
Render a template associated with the provided class name, applying to specified context variables.
resolveClassTemplate()  : string
Recursively locate a template that matches the provided class name (or one of its parent classes); throw an exception if no match is found.

Properties

Methods

__invoke()

Render the output of a recommendation module.

public __invoke(RecommendInterface $recommend[, string $location = null ][, int $index = null ]) : string
Parameters
$recommend : RecommendInterface

The recommendation object to render

$location : string = null

Recommendation location (side, top)

$index : int = null

Index of the recommendation configuration

Return values
string

getBriefClass()

Helper to grab the end of the class name

protected getBriefClass(string $className) : string
Parameters
$className : string

Class name to abbreviate

Return values
string

getCachedClassTemplate()

Resolve the class template file unless already cached and return the file name.

protected getCachedClassTemplate(string $template, string $className) : string
Parameters
$template : string

Template path (with %s as class name placeholder)

$className : string

Name of class to apply to template.

Return values
string

getTemplateWithClass()

Helper to put the template path and class name together

protected getTemplateWithClass(string $template, string $className) : string
Parameters
$template : string

Template path (with %s as class name placeholder)

$className : string

Class name to abbreviate

Return values
string

renderClassTemplate()

Render a template associated with the provided class name, applying to specified context variables.

protected renderClassTemplate(string $template, string $className[, array<string|int, mixed> $context = [] ][, bool $throw = true ]) : string
Parameters
$template : string

Template path (with %s as class name placeholder)

$className : string

Name of class to apply to template.

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

Context for rendering template

$throw : bool = true

If true (default), an exception is thrown if the template is not found. Otherwise an empty string is returned.

Tags
throws
RuntimeException
Return values
string

resolveClassTemplate()

Recursively locate a template that matches the provided class name (or one of its parent classes); throw an exception if no match is found.

protected resolveClassTemplate(string $template, string $className, ResolverInterface $resolver[, string $topClassName = null ]) : string
Parameters
$template : string

Template path (with %s as class name placeholder)

$className : string

Name of class to apply to template.

$resolver : ResolverInterface

Resolver to use

$topClassName : string = null

Top-level parent class of $className (or null if $className is already the top level; used for recursion only).

Return values
string

Search results