You are here

public function Export::buildUrl in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_export/src/Plugin/bibcite/link/Export.php \Drupal\bibcite_export\Plugin\bibcite\link\Export::buildUrl()

Build URL object.

Parameters

\Drupal\bibcite_entity\Entity\ReferenceInterface $reference: Reference entity object.

Overrides BibciteLinkPluginBase::buildUrl

File

modules/bibcite_export/src/Plugin/bibcite/link/Export.php, line 54

Class

Export
Build link to export reference entity.

Namespace

Drupal\bibcite_export\Plugin\bibcite\link

Code

public function buildUrl(ReferenceInterface $reference) {
  if ($reference
    ->isNew()) {
    return NULL;
  }
  $format_id = $this->pluginDefinition['export_format'];
  $definition = $this->formatManager
    ->getDefinition($format_id);
  return Url::fromRoute('bibcite_export.export', [
    'bibcite_format' => $definition['id'],
    'entity_type' => $reference
      ->getEntityTypeId(),
    'entity' => $reference
      ->id(),
  ]);
}