Skip to content
Snippets Groups Projects
Commit 34b1353d authored by Demian Katz's avatar Demian Katz
Browse files

Style fixes.

parent 9d067b77
Branches
Tags
No related merge requests found
......@@ -135,8 +135,8 @@ class Record extends AbstractHelper
}
/**
* Get an array of strings representing formats in which this record's
* data may be exported (empty if none). Legal values: "RefWorks",
* Get an array of strings representing formats in which this record's
* data may be exported (empty if none). Legal values: "RefWorks",
* "EndNote", "MARC", "RDF".
*
* @return array Strings representing export formats.
......@@ -360,44 +360,44 @@ class Record extends AbstractHelper
*
* @return array
*/
public function getLinkDetails()
{
// See if there are any links available:
$urls = $this->driver->tryMethod('getURLs');
if (empty($urls)) {
return array();
}
// If we found links, we may need to convert from the "route" format
// to the "full URL" format.
$urlHelper = $this->getView()->plugin('url');
$serverUrlHelper = $this->getView()->plugin('serverurl');
$formatLink = function ($link) use ($urlHelper, $serverUrlHelper) {
// Error if route AND URL are missing at this point!
if (!isset($link['route']) && !isset($link['url'])) {
throw new \Exception('Invalid URL array.');
}
// Build URL from route/query details if missing:
if (!isset($link['url'])) {
$routeParams = isset($link['routeParams'])
public function getLinkDetails()
{
// See if there are any links available:
$urls = $this->driver->tryMethod('getURLs');
if (empty($urls)) {
return array();
}
// If we found links, we may need to convert from the "route" format
// to the "full URL" format.
$urlHelper = $this->getView()->plugin('url');
$serverUrlHelper = $this->getView()->plugin('serverurl');
$formatLink = function ($link) use ($urlHelper, $serverUrlHelper) {
// Error if route AND URL are missing at this point!
if (!isset($link['route']) && !isset($link['url'])) {
throw new \Exception('Invalid URL array.');
}
// Build URL from route/query details if missing:
if (!isset($link['url'])) {
$routeParams = isset($link['routeParams'])
? $link['routeParams'] : array();
$link['url'] = $serverUrlHelper(
$urlHelper($link['route'], $routeParams)
);
if (isset($link['queryString'])) {
$link['url'] .= $link['queryString'];
}
}
// Use URL as description if missing:
if (!isset($link['desc'])) {
$link['desc'] = $link['url'];
}
return $link;
};
return array_map($formatLink, $urls);
}
$link['url'] = $serverUrlHelper(
$urlHelper($link['route'], $routeParams)
);
if (isset($link['queryString'])) {
$link['url'] .= $link['queryString'];
}
}
// Use URL as description if missing:
if (!isset($link['desc'])) {
$link['desc'] = $link['url'];
}
return $link;
};
return array_map($formatLink, $urls);
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment