@@ -1846,19 +1846,17 @@ public static function getIconForReference(
18461846 bool $ offline = false
18471847 ): string {
18481848 global $ DIC ;
1849-
18501849 $ ilSetting = $ DIC ->settings ();
1851- $ objDefinition = $ DIC ["objDefinition " ];
18521850
18531851 if ($ obj_id == "" && $ type == "" ) {
18541852 return "" ;
18551853 }
18561854
1857- if ($ type == "" ) {
1855+ if ($ type === "" ) {
18581856 $ type = ilObject::_lookupType ($ obj_id );
18591857 }
18601858
1861- if ($ size == "" ) {
1859+ if ($ size === "" ) {
18621860 $ size = "big " ;
18631861 }
18641862
@@ -1884,21 +1882,27 @@ public static function getIconForReference(
18841882 }
18851883
18861884 if (!$ offline ) {
1887- if ($ objDefinition ->isPluginTypeName ($ type )) {
1888- if ($ objDefinition ->getClassName ($ type ) != "" ) {
1889- $ class_name = "il " . $ objDefinition ->getClassName ($ type ) . 'Plugin ' ;
1890- $ location = $ objDefinition ->getLocation ($ type );
1891- if (is_file ($ location . "/class. " . $ class_name . ".php " )) {
1892- return call_user_func ([$ class_name , "_getIcon " ], $ type , $ size , $ obj_id );
1893- }
1894- }
1895- return ilUtil::getImagePath ("standard/icon_cmps.svg " );
1896- }
1885+ return self ::getIconForType ($ type );
1886+ }
1887+ return "./images/standard/icon_ {$ type }.svg " ;
1888+ }
18971889
1898- return ilUtil::getImagePath ("standard/icon_ " . $ type . ".svg " );
1899- } else {
1900- return "./images/standard/icon_ " . $ type . ".svg " ;
1890+ public static function getIconForType (string $ type ): string
1891+ {
1892+ global $ DIC ;
1893+ $ objDefinition = $ DIC ['objDefinition ' ];
1894+ if (!$ objDefinition ->isPluginTypeName ($ type )) {
1895+ return ilUtil::getImagePath ("standard/icon_ {$ type }.svg " );
1896+ }
1897+
1898+ if ($ objDefinition ->getClassName ($ type ) !== '' ) {
1899+ $ class_name = "il {$ objDefinition ->getClassName ($ type )}Plugin " ;
1900+ $ location = $ objDefinition ->getLocation ($ type );
1901+ if (is_file ($ location . "/class. {$ class_name }.php " )) {
1902+ return call_user_func ([$ class_name , '_getIcon ' ], $ type );
1903+ }
19011904 }
1905+ return ilUtil::getImagePath ('standard/icon_cmps.svg ' );
19021906 }
19031907
19041908 /**
0 commit comments