Changeset View
Changeset View
Standalone View
Standalone View
src/view/phui/PHUIHeaderView.php
Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | if ($this->image) { | ||||
array( | array( | ||||
'href' => $this->imageURL, | 'href' => $this->imageURL, | ||||
'class' => 'phui-header-image', | 'class' => 'phui-header-image', | ||||
'style' => 'background-image: url('.$this->image.')', | 'style' => 'background-image: url('.$this->image.')', | ||||
), | ), | ||||
' '); | ' '); | ||||
} | } | ||||
$header = array(); | $viewer = $this->getUser(); | ||||
$header[] = $this->renderObjectSpaceInformation(); | $header = array(); | ||||
if ($viewer) { | |||||
$header[] = id(new PHUISpacesNamespaceContextView()) | |||||
->setUser($viewer) | |||||
->setObject($this->policyObject); | |||||
} | |||||
if ($this->objectName) { | if ($this->objectName) { | ||||
$header[] = array( | $header[] = array( | ||||
phutil_tag( | phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => '/'.$this->objectName, | 'href' => '/'.$this->objectName, | ||||
), | ), | ||||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | $link = javelin_tag( | ||||
'href' => '/policy/explain/'.$phid.'/'.$view_capability.'/', | 'href' => '/policy/explain/'.$phid.'/'.$view_capability.'/', | ||||
'sigil' => 'workflow', | 'sigil' => 'workflow', | ||||
), | ), | ||||
$policy->getShortName()); | $policy->getShortName()); | ||||
return array($icon, $link); | return array($icon, $link); | ||||
} | } | ||||
private function renderObjectSpaceInformation() { | |||||
$viewer = $this->getUser(); | |||||
$object = $this->policyObject; | |||||
if (!$object) { | |||||
return; | |||||
} | |||||
if (!($object instanceof PhabricatorSpacesInterface)) { | |||||
return; | |||||
} | |||||
$space_phid = $object->getSpacePHID(); | |||||
if ($space_phid === null) { | |||||
$default_space = PhabricatorSpacesNamespaceQuery::getDefaultSpace(); | |||||
if ($default_space) { | |||||
$space_phid = $default_space->getPHID(); | |||||
} | |||||
} | |||||
if ($space_phid === null) { | |||||
return; | |||||
} | |||||
return phutil_tag( | |||||
'span', | |||||
array( | |||||
'class' => 'spaces-name', | |||||
), | |||||
array( | |||||
$viewer->renderHandle($space_phid), | |||||
' | ', | |||||
)); | |||||
} | |||||
} | } |