diff --git a/src/applications/uiexample/examples/PHUIObjectItemListExample.php b/src/applications/uiexample/examples/PHUIObjectItemListExample.php index 691c84554c..6bc521dca2 100644 --- a/src/applications/uiexample/examples/PHUIObjectItemListExample.php +++ b/src/applications/uiexample/examples/PHUIObjectItemListExample.php @@ -330,6 +330,8 @@ final class PHUIObjectItemListExample extends PhabricatorUIExample { $list->addItem( id(new PHUIObjectItemView()) ->setImageURI($default_project->getViewURI()) + ->setImageHref('#') + ->setHref('$$$') ->setHeader(pht('Default Project Profile Image')) ->setGrippable(true) ->addAttribute(pht('This is the default project profile image.'))); diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php index 59547c4442..1182d9be92 100644 --- a/src/view/phui/PHUIObjectItemView.php +++ b/src/view/phui/PHUIObjectItemView.php @@ -19,6 +19,7 @@ final class PHUIObjectItemView extends AphrontTagView { private $headIcons = array(); private $disabled; private $imageURI; + private $imageHref; private $imageIcon; private $titleText; private $badge; @@ -127,6 +128,11 @@ final class PHUIObjectItemView extends AphrontTagView { return $this; } + public function setImageHref($image_href) { + $this->imageHref = $image_href; + return $this; + } + public function getImageURI() { return $this->imageURI; } @@ -575,11 +581,12 @@ final class PHUIObjectItemView extends AphrontTagView { $this->getImageIcon()); } - if ($image && $this->href) { + if ($image && (strlen($this->href) || strlen($this->imageHref))) { + $image_href = ($this->imageHref) ? $this->imageHref : $this->href; $image = phutil_tag( 'a', array( - 'href' => $this->href, + 'href' => $image_href, ), $image); }