original_string: 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;
    }
code: 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;
    }
code_tokens: 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 ; }
docstring: Generates link headers for media associated with a node.
docstring_tokens: Generates link headers for media associated with a node .