You are here

class Export 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

Build link to export reference entity.

Plugin annotation


@BibciteLink(
  id = "export",
  label = @Translation("Export"),
  deriver = "Drupal\bibcite_export\Plugin\Derivative\FormatExportLink",
)

Hierarchy

Expanded class hierarchy of Export

5 string references to 'Export'
bibcite_export.links.menu.yml in modules/bibcite_export/bibcite_export.links.menu.yml
modules/bibcite_export/bibcite_export.links.menu.yml
bibcite_export.links.task.yml in modules/bibcite_export/bibcite_export.links.task.yml
modules/bibcite_export/bibcite_export.links.task.yml
bibcite_export.routing.yml in modules/bibcite_export/bibcite_export.routing.yml
modules/bibcite_export/bibcite_export.routing.yml
ExportAllForm::buildForm in modules/bibcite_export/src/Form/ExportAllForm.php
Form constructor.
ExportMultipleForm::getConfirmText in modules/bibcite_export/src/Form/ExportMultipleForm.php
Returns a caption for the button that confirms the action.

File

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

Namespace

Drupal\bibcite_export\Plugin\bibcite\link
View source
class Export extends BibciteLinkPluginBase implements ContainerFactoryPluginInterface {

  /**
   * Format manager.
   *
   * @var \Drupal\bibcite\Plugin\BibciteFormatManagerInterface
   */
  protected $formatManager;

  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, BibciteFormatManagerInterface $format_manager) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->formatManager = $format_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('plugin.manager.bibcite_format'));
  }

  /**
   * {@inheritdoc}
   */
  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(),
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BibciteLinkPluginBase::build public function Build link using data from Reference entity. Overrides BibciteLinkPluginInterface::build
BibciteLinkPluginBase::getLabel public function Get plugin label. Overrides BibciteLinkPluginInterface::getLabel
Export::$formatManager protected property Format manager.
Export::buildUrl public function Build URL object. Overrides BibciteLinkPluginBase::buildUrl
Export::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
Export::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.