PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/src/applications/diviner/view/DivinerBookItemView.php

https://github.com/navyuginfo/phabricator
PHP | 68 lines | 54 code | 14 blank | 0 comment | 0 complexity | f0ac12a7f34141b6dd7205b951c2062a MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.0, LGPL-3.0, MIT, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. <?php
  2. final class DivinerBookItemView extends AphrontTagView {
  3. private $title;
  4. private $subtitle;
  5. private $type;
  6. private $href;
  7. public function setTitle($title) {
  8. $this->title = $title;
  9. return $this;
  10. }
  11. public function setSubtitle($subtitle) {
  12. $this->subtitle = $subtitle;
  13. return $this;
  14. }
  15. public function setType($type) {
  16. $this->type = $type;
  17. return $this;
  18. }
  19. public function setHref($href) {
  20. $this->href = $href;
  21. return $this;
  22. }
  23. public function getTagName() {
  24. return 'a';
  25. }
  26. public function getTagAttributes() {
  27. return array(
  28. 'class' => 'diviner-book-item',
  29. 'href' => $this->href,
  30. );
  31. }
  32. public function getTagContent() {
  33. require_celerity_resource('diviner-shared-css');
  34. $title = phutil_tag(
  35. 'span',
  36. array(
  37. 'class' => 'diviner-book-item-title'
  38. ),
  39. $this->title);
  40. $subtitle = phutil_tag(
  41. 'span',
  42. array(
  43. 'class' => 'diviner-book-item-subtitle'
  44. ),
  45. $this->subtitle);
  46. $type = phutil_tag(
  47. 'span',
  48. array(
  49. 'class' => 'diviner-book-item-type'
  50. ),
  51. $this->type);
  52. return array($title, $type, $subtitle);
  53. }
  54. }