VuFind API Documentation

ResultFeed extends AbstractHelper
in package
implements TranslatorAwareInterface Uses TranslatorAwareTrait

"Results as feed" 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

Interfaces, Classes, Traits and Enums

TranslatorAwareInterface
Lightweight translator aware marker interface (used as an alternative to \Laminas\I18n\Translator\TranslatorAwareInterface, which requires an excessive number of methods to be implemented).

Table of Contents

$overrideTitle  : string
Override title
$translator  : TranslatorInterface
Translator
__invoke()  : Feed
Represent the current search results as a feed.
getTranslator()  : TranslatorInterface
Get translator object.
getTranslatorLocale()  : string
Get the locale from the translator.
registerExtensions()  : void
Set up custom extensions (should be called by factory).
setOverrideTitle()  : void
Set override title.
setTranslator()  : TranslatorAwareInterface
Set a translator
translate()  : string
Translate a string (or string-castable object)
translateWithPrefix()  : string
Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.
addEntry()  : void
Support method to turn a record driver object into an RSS entry.
extractTextDomain()  : array<string|int, mixed>
Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.
getDateModified()  : int|DateTime|null
Support method to extract modified date from a record driver object.
getDcDate()  : string
Support method to extract a date from a record driver. Return empty string if no valid match is found.
getDebugTranslation()  : string
Build a debug-mode translation
sanitizeTranslationKey()  : string
Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
translateString()  : string
Get translation for a string

Properties

$overrideTitle

Override title

protected string $overrideTitle = null

Methods

__invoke()

Represent the current search results as a feed.

public __invoke(Results $results[, string $currentPath = null ]) : Feed
Parameters
$results : Results

Search results to convert to feed

$currentPath : string = null

Base path to display in feed (leave null to load dynamically using currentpath view helper)

Return values
Feed

getTranslator()

Get translator object.

public getTranslator() : TranslatorInterface
Return values
TranslatorInterface

getTranslatorLocale()

Get the locale from the translator.

public getTranslatorLocale([string $default = 'en' ]) : string
Parameters
$default : string = 'en'

Default to use if translator absent.

Return values
string

registerExtensions()

Set up custom extensions (should be called by factory).

public registerExtensions(ContainerInterface $container) : void
Parameters
$container : ContainerInterface

Service container

Return values
void

setOverrideTitle()

Set override title.

public setOverrideTitle(string $title) : void
Parameters
$title : string

Title

Return values
void

translate()

Translate a string (or string-castable object)

public translate(string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
$target : string|object|array<string|int, mixed>

String to translate or an array of text domain and string to translate

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

Tokens to inject into the translated string

$default : string = null

Default value to use if no translation is found (null for no default).

$useIcuFormatter : bool = false

Should we use an ICU message formatter instead of the default behavior?

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

Text domains to check if no match is found in the domain specified in $target

Return values
string

translateWithPrefix()

Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.

public translateWithPrefix(string $prefix, string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
$prefix : string

Translation key prefix

$target : string|object|array<string|int, mixed>

String to translate or an array of text domain and string to translate

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

Tokens to inject into the translated string

$default : string = null

Default value to use if no translation is found (null for no default).

$useIcuFormatter : bool = false

Should we use an ICU message formatter instead of the default behavior?

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

Text domains to check if no match is found in the domain specified in $target

Return values
string

addEntry()

Support method to turn a record driver object into an RSS entry.

protected addEntry(Feed $feed, AbstractBase $record) : void
Parameters
$feed : Feed

Feed to update

$record : AbstractBase

Record to add to feed

Return values
void

extractTextDomain()

Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.

protected extractTextDomain(string|object|array<string|int, mixed> $target) : array<string|int, mixed>
Parameters
$target : string|object|array<string|int, mixed>

String to translate or an array of text domain and string to translate

Return values
array<string|int, mixed>

getDateModified()

Support method to extract modified date from a record driver object.

protected getDateModified(AbstractBase $record) : int|DateTime|null
Parameters
$record : AbstractBase

Record to pull date from.

Return values
int|DateTime|null

getDcDate()

Support method to extract a date from a record driver. Return empty string if no valid match is found.

protected getDcDate(AbstractBase $record) : string
Parameters
$record : AbstractBase

Record to read from

Return values
string

getDebugTranslation()

Build a debug-mode translation

protected getDebugTranslation(string $domain, string $str, array<string|int, mixed> $tokens) : string
Parameters
$domain : string

Text domain

$str : string

String to translate

$tokens : array<string|int, mixed>

Tokens to inject into the translated string

Return values
string

sanitizeTranslationKey()

Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.

protected sanitizeTranslationKey(string $key) : string
Parameters
$key : string

Key to sanitize

Return values
string

Sanitized key

translateString()

Get translation for a string

protected translateString(string $rawStr[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, string $domain = 'default' ][, bool $useIcuFormatter = false ]) : string
Parameters
$rawStr : string

String to translate

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

Tokens to inject into the translated string

$default : string = null

Default value to use if no translation is found (null for no default).

$domain : string = 'default'

Text domain (omit for default)

$useIcuFormatter : bool = false

Should we use an ICU message formatter instead of the default behavior?

Return values
string

Search results