aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggEntity.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-05 22:46:28 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-05 22:46:28 +0000
commite5227e9221edbce84eee82af7f2c9903de702f37 (patch)
tree5e402b5508a8af64ff40761087926dd0f9443303 /engine/classes/ElggEntity.php
parent577eb6f725449fea5738ca122eedb5e4b2c8ff56 (diff)
downloadelgg-e5227e9221edbce84eee82af7f2c9903de702f37.tar.gz
elgg-e5227e9221edbce84eee82af7f2c9903de702f37.tar.bz2
Fixes #2559 refs #2475 added ElggEntity:getIconURL() and elgg_view_entity_icon()
git-svn-id: http://code.elgg.org/elgg/trunk@8039 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/ElggEntity.php')
-rw-r--r--engine/classes/ElggEntity.php41
1 files changed, 36 insertions, 5 deletions
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index 21aa72561..5e43ab582 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -833,18 +833,49 @@ abstract class ElggEntity extends ElggData implements
}
/**
+ * Get the URL for this entity's icon
+ *
+ * Plugins can register for the 'entity:icon:url', <type> plugin hook
+ * to customize the icon for an entity.
+ *
+ * @param string $size Size of the icon: tiny, small, medium, large
+ *
+ * @return string The URL
+ * @since 1.8.0
+ */
+ public function getIconURL($size = 'medium') {
+ $size = elgg_strtolower($size);
+
+ if (isset($this->icon_override[$size])) {
+ elgg_deprecated_notice("icon_override on an individual entity is deprecated", 1.8);
+ return $this->icon_override[$size];
+ }
+
+ $url = "_graphics/icons/default/$size.png";
+ $url = elgg_normalize_url($url);
+
+ $type = $this->getType();
+ $params = array(
+ 'entity' => $this,
+ 'size' => $size,
+ );
+
+ $url = elgg_trigger_plugin_hook('entity:icon:url', $type, $params, $url);
+
+ return elgg_normalize_url($url);
+ }
+
+ /**
* Returns a URL for the entity's icon.
*
* @param string $size Either 'large', 'medium', 'small' or 'tiny'
*
* @return string The url or false if no url could be worked out.
- * @see get_entity_icon_url()
+ * @deprecated Use getIconURL()
*/
public function getIcon($size = 'medium') {
- if (isset($this->icon_override[$size])) {
- return $this->icon_override[$size];
- }
- return get_entity_icon_url($this, $size);
+ elgg_deprecated_notice("getIcon() deprecated by getIconURL()", 1.8);
+ return $this->getIconURL($size);
}
/**