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-03-09 22:52:41 +01:00
|
|
|
return array($marker, $anchor);
|
2012-08-22 00:01:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|