src/Twig/Extension/NetworkingHelperExtension.php
public function getInitcmsAdminIconPath(
        AdminInterface $admin,
        $size = 'small',
        $active = false
    ) {
        $state = $active ? '_active' : '';
        $imagePath = '/bundles/networkinginitcms/img/icons/icon_blank_'.$size.$state.'.png';
        $bundleGuesser = new BundleGuesser();
        $bundleGuesser->initialize($admin);
        $bundleName = $bundleGuesser->getBundleShortName();
        $bundles = $this->kernel->getBundle($bundleName, false);
        $bundle = end($bundles);

        $path = $bundle->getPath();

        $slug = self::slugify($admin->getLabel());

        $iconName = 'icon_'.$slug.'_'.$size.$state;

        $folders = ['img/icons', 'image/icons', 'img', 'image'];

        $imageType = ['gif', 'png', 'jpg', 'jpeg'];

        foreach ($folders as $folder) {
            foreach ($imageType as $type) {
                $icon = $folder.DIRECTORY_SEPARATOR.$iconName.'.'.$type;

                if (file_exists(
                    $path.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.$icon
                )
                ) {
                    $imagePath = 'bundles'.DIRECTORY_SEPARATOR.str_replace(
                            'bundle',
                            '',
                            strtolower($bundleName)
                        ).DIRECTORY_SEPARATOR.$icon;
                }
            }
        }

        return $imagePath;
    }
public function getInitcmsAdminIconPath(
        AdminInterface $admin,
        $size = 'small',
        $active = false
    ) {
        $state = $active ? '_active' : '';
        $imagePath = '/bundles/networkinginitcms/img/icons/icon_blank_'.$size.$state.'.png';
        $bundleGuesser = new BundleGuesser();
        $bundleGuesser->initialize($admin);
        $bundleName = $bundleGuesser->getBundleShortName();
        $bundles = $this->kernel->getBundle($bundleName, false);
        $bundle = end($bundles);

        $path = $bundle->getPath();

        $slug = self::slugify($admin->getLabel());

        $iconName = 'icon_'.$slug.'_'.$size.$state;

        $folders = ['img/icons', 'image/icons', 'img', 'image'];

        $imageType = ['gif', 'png', 'jpg', 'jpeg'];

        foreach ($folders as $folder) {
            foreach ($imageType as $type) {
                $icon = $folder.DIRECTORY_SEPARATOR.$iconName.'.'.$type;

                if (file_exists(
                    $path.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.$icon
                )
                ) {
                    $imagePath = 'bundles'.DIRECTORY_SEPARATOR.str_replace(
                            'bundle',
                            '',
                            strtolower($bundleName)
                        ).DIRECTORY_SEPARATOR.$icon;
                }
            }
        }

        return $imagePath;
    }
public function getInitcmsAdminIconPath ( AdminInterface $ admin , $ size = 'small' , $ active = false ) { $ state = $ active ? '_active' : '' ; $ imagePath = '/bundles/networkinginitcms/img/icons/icon_blank_' . $ size . $ state . '.png' ; $ bundleGuesser = new BundleGuesser ( ) ; $ bundleGuesser -> initialize ( $ admin ) ; $ bundleName = $ bundleGuesser -> getBundleShortName ( ) ; $ bundles = $ this -> kernel -> getBundle ( $ bundleName , false ) ; $ bundle = end ( $ bundles ) ; $ path = $ bundle -> getPath ( ) ; $ slug = self :: slugify ( $ admin -> getLabel ( ) ) ; $ iconName = 'icon_' . $ slug . '_' . $ size . $ state ; $ folders = [ 'img/icons' , 'image/icons' , 'img' , 'image' ] ; $ imageType = [ 'gif' , 'png' , 'jpg' , 'jpeg' ] ; foreach ( $ folders as $ folder ) { foreach ( $ imageType as $ type ) { $ icon = $ folder . DIRECTORY_SEPARATOR . $ iconName . '.' . $ type ; if ( file_exists ( $ path . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . $ icon ) ) { $ imagePath = 'bundles' . DIRECTORY_SEPARATOR . str_replace ( 'bundle' , '' , strtolower ( $ bundleName ) ) . DIRECTORY_SEPARATOR . $ icon ; } } } return $ imagePath ; }
Guess which icon should represent an entity admin.

@param AdminInterface $admin
@param string         $size
@param bool           $active

@return string

@todo This is a bit of a hack. Need to provide a better way of providing admin icons
Guess which icon should represent an entity admin .