RecordLinker
extends AbstractHelper
in package
Record linker view helper
Tags
Table of Contents
- $cachedDriverUrls : array<string|int, mixed>
- Cached record URLs
- $results : Results
- Search results (optional)
- $router : Router
- Record router
- __construct() : mixed
- Constructor
- __invoke() : RecordLinker
- Store an optional results object and return this object so that the appropriate link can be rendered.
- getActionUrl() : string
- Given a record driver, get a URL for that record.
- getBreadcrumbHtml() : string
- Given a record driver, generate HTML to link to the record from breadcrumbs.
- getChildRecordSearchUrl() : string
- Given a record driver, generate a URL to fetch all child records for it.
- getRequestUrl() : string
- Given a string or array of parts, build a request (e.g. hold) URL.
- getTabUrl() : string
- Given a record driver, get a URL for that record.
- getUrl() : string
- Get the default URL for a record.
- getVersionsSearchUrl() : string
- Return search URL for all versions
- related() : string
- Given an array representing a related record (which may be a bib ID or OCLC number), this helper renders a URL linking to that record.
- getRecordUrlParams() : array<string|int, mixed>
- Get query parameters for a record URL
- getSearchActionForSource() : string
- Given a record source ID, return the route name for searching its backend.
- getVersionsActionForSource() : string|bool
- Given a record source ID, return the route name for version search with its backend.
Properties
$cachedDriverUrls
Cached record URLs
protected
array<string|int, mixed>
$cachedDriverUrls
= []
$results
Search results (optional)
protected
Results
$results
= null
$router
Record router
protected
Router
$router
Methods
__construct()
Constructor
public
__construct(Router $router) : mixed
Parameters
- $router : Router
-
Record router
Return values
mixed —__invoke()
Store an optional results object and return this object so that the appropriate link can be rendered.
public
__invoke([Results|null $results = null ]) : RecordLinker
Parameters
- $results : Results|null = null
-
Results object.
Return values
RecordLinker —getActionUrl()
Given a record driver, get a URL for that record.
public
getActionUrl(AbstractBase|string $driver, string $action[, array<string|int, mixed> $query = [] ][, string $anchor = '' ][, array<string|int, mixed> $options = [] ]) : string
Parameters
- $driver : AbstractBase|string
-
Record driver representing record to link to, or source|id pipe-delimited string
- $action : string
-
Record action to access
- $query : array<string|int, mixed> = []
-
Optional query parameters
- $anchor : string = ''
-
Optional anchor
- $options : array<string|int, mixed> = []
-
Record URL parameter options (optional)
Return values
string —getBreadcrumbHtml()
Given a record driver, generate HTML to link to the record from breadcrumbs.
public
getBreadcrumbHtml(AbstractBase $driver) : string
Parameters
- $driver : AbstractBase
-
Record to link to.
Return values
string —getChildRecordSearchUrl()
Given a record driver, generate a URL to fetch all child records for it.
public
getChildRecordSearchUrl(AbstractBase $driver) : string
Parameters
- $driver : AbstractBase
-
Host Record.
Return values
string —getRequestUrl()
Given a string or array of parts, build a request (e.g. hold) URL.
public
getRequestUrl(string|array<string|int, mixed> $url[, bool $includeAnchor = true ]) : string
Parameters
- $url : string|array<string|int, mixed>
-
URL to process
- $includeAnchor : bool = true
-
Should we include an anchor?
Return values
string —getTabUrl()
Given a record driver, get a URL for that record.
public
getTabUrl(AbstractBase|string $driver[, string|null $tab = null ][, array<string|int, mixed> $query = [] ][, array<string|int, mixed> $options = [] ]) : string
Parameters
- $driver : AbstractBase|string
-
Record driver representing record to link to, or source|id pipe-delimited string
- $tab : string|null = null
-
Optional record tab to access
- $query : array<string|int, mixed> = []
-
Optional query params
- $options : array<string|int, mixed> = []
-
Any additional options:
- excludeSearchId (default: false)
Return values
string —getUrl()
Get the default URL for a record.
public
getUrl(AbstractBase|string $driver[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $driver : AbstractBase|string
-
Record driver representing record to link to, or source|id pipe-delimited string
- $options : array<string|int, mixed> = []
-
Any additional options:
- excludeSearchId (default: false)
Return values
string —getVersionsSearchUrl()
Return search URL for all versions
public
getVersionsSearchUrl(AbstractBase $driver) : string
Parameters
- $driver : AbstractBase
-
Record driver
Return values
string —related()
Given an array representing a related record (which may be a bib ID or OCLC number), this helper renders a URL linking to that record.
public
related(array<string|int, mixed> $link[, string $source = DEFAULT_SEARCH_BACKEND ]) : string
Parameters
- $link : array<string|int, mixed>
-
Link information from record model
- $source : string = DEFAULT_SEARCH_BACKEND
-
Source ID for backend being used to retrieve records
Return values
string —URL derived from link information
getRecordUrlParams()
Get query parameters for a record URL
protected
getRecordUrlParams([array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed> = []
-
Any additional options:
- excludeSearchId (default: false)
Return values
array<string|int, mixed> —getSearchActionForSource()
Given a record source ID, return the route name for searching its backend.
protected
getSearchActionForSource(string $source) : string
Parameters
- $source : string
-
Record source identifier.
Return values
string —getVersionsActionForSource()
Given a record source ID, return the route name for version search with its backend.
protected
getVersionsActionForSource(string $source) : string|bool
Parameters
- $source : string
-
Record source identifier.