1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-16 17:51:11 +01:00
phorge-phorge/src/view/layout/PhabricatorHeaderView.php
epriestley f548dc0067 Remove PhabricatorProfileHeaderView in favor of PhabricatorHeaderView
Summary:
We have this old view which is only used in two places and looks the same but has totally different markup. Get rid of it.

@chad, I'm generally going to move the user/project profiles a step toward looking like other object detail view with the custom field stuff. Not sure if you have any grand vision here; we can easily do something else later since this is like 80% "delete weird epriestley one-offs that don't look quite right in favor of standard elements".

Test Plan: {F49324} {F49325} {F49326}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6394
2013-07-09 16:23:22 -07:00

101 lines
1.9 KiB
PHP

<?php
final class PhabricatorHeaderView extends AphrontView {
private $objectName;
private $header;
private $tags = array();
private $image;
private $subheader;
public function setHeader($header) {
$this->header = $header;
return $this;
}
public function setObjectName($object_name) {
$this->objectName = $object_name;
return $this;
}
public function addTag(PhabricatorTagView $tag) {
$this->tags[] = $tag;
return $this;
}
public function setImage($uri) {
$this->image = $uri;
return $this;
}
public function setSubheader($subheader) {
$this->subheader = $subheader;
return $this;
}
public function render() {
require_celerity_resource('phabricator-header-view-css');
$image = null;
if ($this->image) {
$image = phutil_tag(
'span',
array(
'class' => 'phabricator-header-image',
'style' => 'background-image: url('.$this->image.')',
),
'');
}
$header = array();
$header[] = $this->header;
if ($this->objectName) {
array_unshift(
$header,
phutil_tag(
'a',
array(
'href' => '/'.$this->objectName,
),
$this->objectName),
' ');
}
if ($this->tags) {
$header[] = ' ';
$header[] = phutil_tag(
'span',
array(
'class' => 'phabricator-header-tags',
),
array_interleave(' ', $this->tags));
}
if ($this->subheader) {
$header[] = phutil_tag(
'div',
array(
'class' => 'phabricator-header-subheader',
),
$this->subheader);
}
return phutil_tag(
'div',
array(
'class' => 'phabricator-header-shell',
),
array(
$image,
phutil_tag(
'h1',
array(
'class' => 'phabricator-header-view',
),
$header),
));
}
}