diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-05 22:46:28 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-05 22:46:28 +0000 |
commit | e5227e9221edbce84eee82af7f2c9903de702f37 (patch) | |
tree | 5e402b5508a8af64ff40761087926dd0f9443303 /engine/lib/entities.php | |
parent | 577eb6f725449fea5738ca122eedb5e4b2c8ff56 (diff) | |
download | elgg-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/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 2a3c6ba91..ac2679dfc 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1759,79 +1759,6 @@ function can_edit_entity_metadata($entity_guid, $user_guid = 0, $metadata = null } /** - * Return the icon URL for an entity. - * - * @tip Can be overridden by registering a plugin hook for entity:icon:url, $entity_type. - * - * @internal This is passed an entity rather than a guid to handle non-created entities. - * - * @param ElggEntity $entity The entity - * @param string $size Icon size - * - * @return string URL to the entity icon. - */ -function get_entity_icon_url(ElggEntity $entity, $size = 'medium') { - global $CONFIG; - - $size = sanitise_string($size); - switch (strtolower($size)) { - case 'master': - $size = 'master'; - break; - - case 'large' : - $size = 'large'; - break; - - case 'topbar' : - $size = 'topbar'; - break; - - case 'tiny' : - $size = 'tiny'; - break; - - case 'small' : - $size = 'small'; - break; - - case 'medium' : - default: - $size = 'medium'; - } - - $url = false; - - $viewtype = elgg_get_viewtype(); - - // Step one, see if anyone knows how to render this in the current view - $params = array('entity' => $entity, 'viewtype' => $viewtype, 'size' => $size); - $url = elgg_trigger_plugin_hook('entity:icon:url', $entity->getType(), $params, $url); - - // Fail, so use default - if (!$url) { - $type = $entity->getType(); - $subtype = $entity->getSubtype(); - - if (!empty($subtype)) { - $overrideurl = elgg_view("icon/{$type}/{$subtype}/{$size}", array('entity' => $entity)); - if (!empty($overrideurl)) { - return $overrideurl; - } - } - - $overrideurl = elgg_view("icon/{$type}/default/{$size}", array('entity' => $entity)); - if (!empty($overrideurl)) { - return $overrideurl; - } - - $url = "_graphics/icons/default/$size.png"; - } - - return elgg_normalize_url($url); -} - -/** * Returns the URL for an entity. * * @tip Can be overridden with {@link register_entity_url_handler()}. @@ -1869,7 +1796,6 @@ function get_entity_url($entity_guid) { } return elgg_normalize_url($url); - } return false; @@ -1909,46 +1835,6 @@ $entity_subtype = "all") { } /** - * Default Icon handler for entities. - * - * @tip This will attempt to find a default entity for the current view and return a url. - * This is registered at a high priority so that other handlers will pick it up first. - * - * @param string $hook entity:icon:url - * @param string $entity_type all - * @param mixed $returnvalue Previous hook's return value - * @param array $params Array of params - * - * @return string|null String of URL for entity's icon - * @elgg_plugin_hook_handler entity:icon:url all - */ -function default_entity_icon_hook($hook, $entity_type, $returnvalue, $params) { - global $CONFIG; - - if ((!$returnvalue) && ($hook == 'entity:icon:url')) { - $entity = $params['entity']; - $type = $entity->type; - $subtype = get_subtype_from_id($entity->subtype); - $viewtype = $params['viewtype']; - $size = $params['size']; - - $url = "views/$viewtype/graphics/icons/$type/$subtype/$size.png"; - - if (!@file_exists($CONFIG->path . $url)) { - $url = "views/$viewtype/graphics/icons/$type/default/$size.png"; - } - - if (!@file_exists($CONFIG->path . $url)) { - $url = "views/$viewtype/graphics/icons/default/$size.png"; - } - - if (@file_exists($CONFIG->path . $url)) { - return elgg_get_site_url() . $url; - } - } -} - -/** * Registers an entity type and subtype as a public-facing entity that should * be shown in search and by {@link elgg_list_registered_entities()}. * @@ -2311,8 +2197,5 @@ elgg_register_plugin_hook_handler("export", "all", "export_entity_plugin_hook", /** Hook to get certain named bits of volatile data about an entity */ elgg_register_plugin_hook_handler('volatile', 'metadata', 'volatile_data_export_plugin_hook'); -/** Hook for rendering a default icon for entities */ -elgg_register_plugin_hook_handler('entity:icon:url', 'all', 'default_entity_icon_hook', 1000); - /** Register init system event **/ elgg_register_event_handler('init', 'system', 'entities_init'); |