Path: blob/master/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php
12242 views
<?php12/**3* Wraps an inline comment in a table row.4*5* Inline comments need different wrapping cells when shown in unified vs6* side-by-side diffs, as the two tables have different layouts. This wraps7* an inline comment element in an appropriate table row.8*/9abstract class PHUIDiffInlineCommentRowScaffold extends AphrontView {1011private $views = array();12private $isUndoTemplate;1314final public function setIsUndoTemplate($is_undo_template) {15$this->isUndoTemplate = $is_undo_template;16return $this;17}1819final public function getIsUndoTemplate() {20return $this->isUndoTemplate;21}2223public function getInlineViews() {24return $this->views;25}2627public function addInlineView(PHUIDiffInlineCommentView $view) {28$this->views[] = $view;29return $this;30}3132protected function getRowAttributes() {33$is_undo_template = $this->getIsUndoTemplate();3435$is_hidden = false;36if ($is_undo_template) {3738// NOTE: When this scaffold is turned into an "undo" template, it is39// important it not have any metadata: the metadata reference will be40// copied to each instance of the row. This is a complicated mess; for41// now, just sneak by without generating metadata when rendering undo42// templates.4344$metadata = null;45} else {46foreach ($this->getInlineViews() as $view) {47if ($view->isHidden()) {48$is_hidden = true;49}50}5152$metadata = array(53'hidden' => $is_hidden,54);55}5657$classes = array();58$classes[] = 'inline';59if ($is_hidden) {60$classes[] = 'inline-hidden';61}6263$result = array(64'class' => implode(' ', $classes),65'sigil' => 'inline-row',66'meta' => $metadata,67);6869return $result;70}7172}737475