2012-08-22 00:01:20 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorAnchorView extends AphrontView {
|
|
|
|
|
|
|
|
private $anchorName;
|
|
|
|
private $navigationMarker;
|
|
|
|
|
|
|
|
public function setAnchorName($name) {
|
|
|
|
$this->anchorName = $name;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setNavigationMarker($marker) {
|
|
|
|
$this->navigationMarker = $marker;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
|
|
|
$marker = null;
|
|
|
|
if ($this->navigationMarker) {
|
2013-01-25 21:57:17 +01:00
|
|
|
$marker = javelin_tag(
|
2012-08-22 00:01:20 +02:00
|
|
|
'legend',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-anchor-navigation-marker',
|
|
|
|
'sigil' => 'marker',
|
|
|
|
'meta' => array(
|
|
|
|
'anchor' => $this->anchorName,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'');
|
|
|
|
}
|
|
|
|
|
2013-01-18 03:57:09 +01:00
|
|
|
$anchor = phutil_tag(
|
2012-08-22 00:01:20 +02:00
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'name' => $this->anchorName,
|
|
|
|
'id' => $this->anchorName,
|
|
|
|
'class' => 'phabricator-anchor-view',
|
|
|
|
),
|
|
|
|
'');
|
|
|
|
|
2013-02-11 23:43:25 +01:00
|
|
|
return $this->renderSingleView(array($marker, $anchor));
|
2012-08-22 00:01:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|