Classes/ViewHelpers/ResultViewHelper.php
protected function electronicURLs($location, $result)
    {
        $electronicURLs = $this->cleanURLList($location, $result);
        $URLsContainer = null;

        if ($electronicURLs && count($electronicURLs) != 0) {
            $URLsContainer = $this->doc->createElement('span');

            foreach ($electronicURLs as $URLInfo) {
                $linkTexts = [];
                $linkURL = $URLInfo['values'][0];

                if ($URLInfo['attrs']['name']) {
                    $linkTexts[] = $URLInfo['attrs']['name'];
                    if ($URLInfo['attrs']['note']) {
                        $linkTexts[] = $URLInfo['attrs']['note'];
                    }
                } elseif ($URLInfo['attrs']['note']) {
                    $linkTexts[] = $URLInfo['attrs']['note'];
                } elseif ($URLInfo['attrs']['fulltextfile']) {
                    $linkTexts[] = 'Document';
                } else {
                    $linkTexts[] = 'Link';
                }

                $localisedLinkTexts = [];
                foreach ($linkTexts as $linkText) {
                    $localisedLinkText = LocalizationUtility::translate('link-description-' . $linkText, 'Pazpar2');
                    if (!$localisedLinkText) {
                        $localisedLinkText = $linkText;
                    }
                    $localisedLinkTexts[] = $localisedLinkText;
                }
                $linkText = '[' . implode(', ', $localisedLinkTexts) . ']';

                if ($URLsContainer->hasChildNodes()) {
                    $URLsContainer->appendChild($this->doc->createTextNode(', '));
                }

                $link = $this->doc->createElement('a');
                $URLsContainer->appendChild($link);
                $link->setAttribute('class', 'pz2-electronic-url');
                $link->setAttribute('href', $linkURL);
                $this->turnIntoNewWindowLink($link);
                $link->appendChild($this->doc->createTextNode($linkText));
            }
            $URLsContainer->appendChild($this->doc->createTextNode('; '));
        }

        return $URLsContainer;
    }
protected function electronicURLs($location, $result)
    {
        $electronicURLs = $this->cleanURLList($location, $result);
        $URLsContainer = null;

        if ($electronicURLs && count($electronicURLs) != 0) {
            $URLsContainer = $this->doc->createElement('span');

            foreach ($electronicURLs as $URLInfo) {
                $linkTexts = [];
                $linkURL = $URLInfo['values'][0];

                if ($URLInfo['attrs']['name']) {
                    $linkTexts[] = $URLInfo['attrs']['name'];
                    if ($URLInfo['attrs']['note']) {
                        $linkTexts[] = $URLInfo['attrs']['note'];
                    }
                } elseif ($URLInfo['attrs']['note']) {
                    $linkTexts[] = $URLInfo['attrs']['note'];
                } elseif ($URLInfo['attrs']['fulltextfile']) {
                    $linkTexts[] = 'Document';
                } else {
                    $linkTexts[] = 'Link';
                }

                $localisedLinkTexts = [];
                foreach ($linkTexts as $linkText) {
                    $localisedLinkText = LocalizationUtility::translate('link-description-' . $linkText, 'Pazpar2');
                    if (!$localisedLinkText) {
                        $localisedLinkText = $linkText;
                    }
                    $localisedLinkTexts[] = $localisedLinkText;
                }
                $linkText = '[' . implode(', ', $localisedLinkTexts) . ']';

                if ($URLsContainer->hasChildNodes()) {
                    $URLsContainer->appendChild($this->doc->createTextNode(', '));
                }

                $link = $this->doc->createElement('a');
                $URLsContainer->appendChild($link);
                $link->setAttribute('class', 'pz2-electronic-url');
                $link->setAttribute('href', $linkURL);
                $this->turnIntoNewWindowLink($link);
                $link->appendChild($this->doc->createTextNode($linkText));
            }
            $URLsContainer->appendChild($this->doc->createTextNode('; '));
        }

        return $URLsContainer;
    }
protected function electronicURLs ( $ location , $ result ) { $ electronicURLs = $ this -> cleanURLList ( $ location , $ result ) ; $ URLsContainer = null ; if ( $ electronicURLs && count ( $ electronicURLs ) != 0 ) { $ URLsContainer = $ this -> doc -> createElement ( 'span' ) ; foreach ( $ electronicURLs as $ URLInfo ) { $ linkTexts = [ ] ; $ linkURL = $ URLInfo [ 'values' ] [ 0 ] ; if ( $ URLInfo [ 'attrs' ] [ 'name' ] ) { $ linkTexts [ ] = $ URLInfo [ 'attrs' ] [ 'name' ] ; if ( $ URLInfo [ 'attrs' ] [ 'note' ] ) { $ linkTexts [ ] = $ URLInfo [ 'attrs' ] [ 'note' ] ; } } elseif ( $ URLInfo [ 'attrs' ] [ 'note' ] ) { $ linkTexts [ ] = $ URLInfo [ 'attrs' ] [ 'note' ] ; } elseif ( $ URLInfo [ 'attrs' ] [ 'fulltextfile' ] ) { $ linkTexts [ ] = 'Document' ; } else { $ linkTexts [ ] = 'Link' ; } $ localisedLinkTexts = [ ] ; foreach ( $ linkTexts as $ linkText ) { $ localisedLinkText = LocalizationUtility :: translate ( 'link-description-' . $ linkText , 'Pazpar2' ) ; if ( ! $ localisedLinkText ) { $ localisedLinkText = $ linkText ; } $ localisedLinkTexts [ ] = $ localisedLinkText ; } $ linkText = '[' . implode ( ', ' , $ localisedLinkTexts ) . ']' ; if ( $ URLsContainer -> hasChildNodes ( ) ) { $ URLsContainer -> appendChild ( $ this -> doc -> createTextNode ( ', ' ) ) ; } $ link = $ this -> doc -> createElement ( 'a' ) ; $ URLsContainer -> appendChild ( $ link ) ; $ link -> setAttribute ( 'class' , 'pz2-electronic-url' ) ; $ link -> setAttribute ( 'href' , $ linkURL ) ; $ this -> turnIntoNewWindowLink ( $ link ) ; $ link -> appendChild ( $ this -> doc -> createTextNode ( $ linkText ) ) ; } $ URLsContainer -> appendChild ( $ this -> doc -> createTextNode ( '; ' ) ) ; } return $ URLsContainer ; }
Create markup for URLs in current location data.
@param array $location
@param array $result the result containing $location
@return \DOMElement
Create markup for URLs in current location data .