You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

  1. <?php
  2. /**
  3. * Refbase entry renderer using the Cite extension tag (<ref>)
  4. */
  5. class RefbaseRendererCite extends RefbaseRenderer {
  6. /// Object generating citations
  7. private $citationCreator;
  8. /**
  9. * Constructor (simply inherit from parent)
  10. */
  11. public function __construct( $citationType ) {
  12. parent::__construct();
  13. $this->citationCreator = new RefbaseCitationCreator( $citationType );
  14. }
  15. /**
  16. * List fields required to build template
  17. */
  18. public function getFieldList() {
  19. $citeList = $this->citationCreator->getFieldList();
  20. return array_unique( array_merge( array(), $citeList ) );
  21. }
  22. /**
  23. * Render output: add wiki link to refbase page, include citation in tooltip
  24. */
  25. public function render( $entry, & $cite, $options ) {
  26. $citekey = $options['citekey'];
  27. $cite = "";
  28. // Simply link to refbase, and add tooltip
  29. // (form string [URL <span title="CITATION"> KEY </span>] )
  30. $citation = "";
  31. $this->citationCreator->createCitation( $entry, $citation );
  32. // Use #tag method to properly pass inputs to <ref>
  33. $cite .= "{{#tag:ref|$citation|name=$citekey}}";
  34. return true;
  35. }
  36. }