getIcon() public method

Returns entity icon as an ElggIcon object The icon file may or may not exist on filestore
public getIcon ( string $size, string $type = 'icon' ) : ElggIcon
$size string Size of the icon
$type string The name of the icon. e.g., 'icon', 'cover_photo'
return ElggIcon
Example #1
0
 public static function getExtraValues(ElggEntity $entity)
 {
     global $CONFIG;
     if (!$entity) {
         return FALSE;
     }
     $return['url'] = $entity->getURL();
     $return['subtype'] = $entity->getSubtype();
     $return['title'] = $entity->title;
     $return['icon_small'] = $entity->getIcon('small');
     $return['icon_medium'] = $entity->getIcon('medium');
     $return['icon_large'] = $entity->getIcon('large');
     $return['access_id'] = $entity->access_id;
     $return['site_url'] = $CONFIG->wwwroot;
     if ($entity->canEdit()) {
         $return['canedit'] = $entity->canEdit();
     }
     if ((string) $entity->container_name == '') {
         $container_entity = get_entity($entity->container_guid);
         if ($container_entity) {
             $return['container_name'] = $container_entity->name;
             $return['container_username'] = $container_entity->username;
             $return['container_url'] = $container_entity->getURL();
             $return['container_icon'] = str_replace('size=medium', 'size=small', $container_entity->getIcon());
         }
     } else {
         $return['container_name'] = $entity->name;
         $return['container_username'] = $entity->username;
         $return['container_url'] = $entity->getURL();
         $return['container_icon'] = str_replace('size=medium', 'size=small', $entity->getIcon());
     }
     return $return;
 }