protected function generateRelatedMediaLinks(NodeInterface $node) {
    $links = [];
    foreach ($this->utils->getMedia($node) as $media) {
      $url = $media->url('canonical', ['absolute' => TRUE]);
      foreach ($media->referencedEntities() as $term) {
        if ($term->getEntityTypeId() == 'taxonomy_term' && $term->hasField('field_external_uri')) {
          $field = $term->get('field_external_uri');
          if (!$field->isEmpty()) {
            $link = $field->first()->getValue();
            $uri = $link['uri'];
            if (strpos($uri, 'http://pcdm.org/use#') === 0) {
              $title = $term->label();
              $links[] = "<$url>; rel=\"related\"; title=\"$title\"";
            }
          }
        }
      }
    }
    return $links;
  }
protected function generateRelatedMediaLinks(NodeInterface $node) {
    $links = [];
    foreach ($this->utils->getMedia($node) as $media) {
      $url = $media->url('canonical', ['absolute' => TRUE]);
      foreach ($media->referencedEntities() as $term) {
        if ($term->getEntityTypeId() == 'taxonomy_term' && $term->hasField('field_external_uri')) {
          $field = $term->get('field_external_uri');
          if (!$field->isEmpty()) {
            $link = $field->first()->getValue();
            $uri = $link['uri'];
            if (strpos($uri, 'http://pcdm.org/use#') === 0) {
              $title = $term->label();
              $links[] = "<$url>; rel=\"related\"; title=\"$title\"";
            }
          }
        }
      }
    }
    return $links;
  }
protected function generateRelatedMediaLinks ( NodeInterface $ node ) { $ links = [ ] ; foreach ( $ this -> utils -> getMedia ( $ node ) as $ media ) { $ url = $ media -> url ( 'canonical' , [ 'absolute' => TRUE ] ) ; foreach ( $ media -> referencedEntities ( ) as $ term ) { if ( $ term -> getEntityTypeId ( ) == 'taxonomy_term' && $ term -> hasField ( 'field_external_uri' ) ) { $ field = $ term -> get ( 'field_external_uri' ) ; if ( ! $ field -> isEmpty ( ) ) { $ link = $ field -> first ( ) -> getValue ( ) ; $ uri = $ link [ 'uri' ] ; if ( strpos ( $ uri , 'http://pcdm.org/use#' ) === 0 ) { $ title = $ term -> label ( ) ; $ links [ ] = "<$url>; rel=\"related\"; title=\"$title\"" ; } } } } } return $ links ; }
Generates link headers for media associated with a node.
Generates link headers for media associated with a node .