/**
  * Get URLs for a record as an array
  *
  * @param \VuFind\RecordDriver\SolrDefault $record Record driver
  *
  * @return array|null
  */
 protected function getRecordURLs($record)
 {
     $urls = $record->getURLs();
     $serviceUrls = $record->tryMethod('getServiceUrls');
     $translationEmpty = $this->getViewRenderer()->plugin('translationEmpty');
     if ($urls) {
         foreach ($urls as &$url) {
             if (isset($url['desc']) && !$translationEmpty('link_' . $url['desc'])) {
                 $url['translated'] = $this->translate('link_' . $url['desc']);
                 unset($url['desc']);
             }
         }
     }
     if ($serviceUrls) {
         $source = $record->getDataSource();
         foreach ($serviceUrls as &$url) {
             if (isset($url['desc']) && !$translationEmpty($source . '_' . $url['desc'])) {
                 $url['translated'] = $this->translate($source . '_' . $url['desc']);
                 unset($url['desc']);
             }
         }
         $urls += $serviceUrls;
     }
     return $urls ? $urls : null;
 }
Exemple #2
0
 /**
  * Return an array of associative URL arrays with one or more of the following
  * keys:
  *
  * <li>
  *   <ul>desc: URL description text to display (optional)</ul>
  *   <ul>url: fully-formed URL (required if 'route' is absent)</ul>
  *   <ul>route: VuFind route to build URL with (required if 'url' is absent)</ul>
  *   <ul>routeParams: Parameters for route (optional)</ul>
  *   <ul>queryString: Query params to append after building route (optional)</ul>
  * </li>
  *
  * @return array
  */
 public function getURLs()
 {
     $urls = [];
     foreach (parent::getURLs() as $url) {
         if (!$this->urlBlacklisted(isset($url['url']) ? $url['url'] : '', isset($url['desc']) ? $url['desc'] : '')) {
             $urls[] = $url;
         }
     }
     return $urls;
 }