3 final class PasteEmbedView
extends AphrontView
{
7 private $highlights = array();
10 public function setPaste(PhabricatorPaste
$paste) {
11 $this->paste
= $paste;
15 public function setHandle(PhabricatorObjectHandle
$handle) {
16 $this->handle
= $handle;
20 public function setHighlights(array $highlights) {
21 $this->highlights
= $highlights;
25 public function setLines($lines) {
26 $this->lines
= $lines;
30 public function render() {
32 throw new PhutilInvalidStateException('setPaste');
35 $lines = phutil_split_lines($this->paste
->getContent());
36 require_celerity_resource('paste-css');
41 'href' => '/P'.$this->paste
->getID(),
43 $this->handle
->getFullName());
48 'class' => 'paste-embed-head',
52 $body_attributes = array('class' => 'paste-embed-body');
53 if ($this->lines
!= null) {
54 $body_attributes['style'] = 'max-height: '.$this->lines
* (1.15).'em;';
60 id(new PhabricatorSourceCodeView())
62 ->setHighlights($this->highlights
)
63 ->disableHighlightOnClick());
67 array('class' => 'paste-embed'),