@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make PHUIIconView extend AprontTagView

Summary: Less code, more options.

Test Plan: Test UIExamples page (action headers, tokens, icons and images). No visible difference.

Reviewers: epriestley, btrahan, vrana

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5742

+16 -37
+1 -1
src/__phutil_library_map__.php
··· 2374 2374 'PHUIBoxView' => 'AphrontTagView', 2375 2375 'PHUIFeedStoryView' => 'AphrontView', 2376 2376 'PHUIIconExample' => 'PhabricatorUIExample', 2377 - 'PHUIIconView' => 'AphrontView', 2377 + 'PHUIIconView' => 'AphrontTagView', 2378 2378 'PackageCreateMail' => 'PackageMail', 2379 2379 'PackageDeleteMail' => 'PackageMail', 2380 2380 'PackageMail' => 'PhabricatorMail',
+15 -36
src/view/phui/PHUIIconView.php
··· 1 1 <?php 2 2 3 - final class PHUIIconView extends AphrontView { 3 + final class PHUIIconView extends AphrontTagView { 4 4 5 5 const SPRITE_MINICONS = 'minicons'; 6 6 const SPRITE_ACTIONS = 'actions'; ··· 10 10 const HEAD_SMALL = 'phuihead-small'; 11 11 const HEAD_MEDIUM = 'phuihead-medium'; 12 12 13 - private $href; 14 - private $workflow; 13 + private $href = null; 15 14 private $image; 16 15 private $headSize = null; 17 16 private $spriteIcon; ··· 22 21 return $this; 23 22 } 24 23 25 - public function setWorkflow($workflow) { 26 - $this->workflow = $workflow; 27 - return $this; 28 - } 29 - 30 24 public function setImage($image) { 31 25 $this->image = $image; 32 26 return $this; ··· 47 41 return $this; 48 42 } 49 43 50 - public function render() { 51 - require_celerity_resource('phui-icon-view-css'); 52 - 44 + public function getTagName() { 53 45 $tag = 'span'; 54 46 if ($this->href) { 55 47 $tag = 'a'; 56 48 } 49 + return $tag; 50 + } 57 51 58 - $classes = array(); 59 - $classes[] = 'phui-icon-item-link'; 52 + public function getTagAttributes() { 53 + require_celerity_resource('phui-icon-view-css'); 54 + 55 + $this->addClass('phui-icon-item-link'); 60 56 61 57 if ($this->spriteIcon) { 62 58 require_celerity_resource('sprite-'.$this->spriteSheet.'-css'); 63 - $classes[] = 'sprite-'.$this->spriteSheet; 64 - $classes[] = $this->spriteSheet.'-'.$this->spriteIcon; 65 - 66 - $action_icon = phutil_tag( 67 - $tag, 68 - array( 69 - 'href' => $this->href ? $this->href : null, 70 - 'class' => implode(' ', $classes), 71 - 'sigil' => $this->workflow ? 'workflow' : null, 72 - ), 73 - ''); 59 + $this->addClass('sprite-'.$this->spriteSheet); 60 + $this->addClass($this->spriteSheet.'-'.$this->spriteIcon); 74 61 } else { 75 62 if ($this->headSize) { 76 - $classes[] = $this->headSize; 63 + $this->addClass($this->headSize); 77 64 } 78 - 79 - $action_icon = phutil_tag( 80 - $tag, 81 - array( 82 - 'href' => $this->href ? $this->href : null, 83 - 'class' => implode(' ', $classes), 84 - 'sigil' => $this->workflow ? 'workflow' : null, 85 - 'style' => 'background-image: url('.$this->image.');' 86 - ), 87 - ''); 65 + $this->setStyle('background-image: url('.$this->image.');'); 88 66 } 89 67 90 - return $action_icon; 68 + $attribs = array('href' => $this->href); 69 + return $attribs; 91 70 } 92 71 }