[Cartoweb-users] Get layers icon in LayerReorder plugin

Simon ORTET simon.ortet at silogic.fr
Fri Aug 24 11:25:07 EDT 2007


Hi,

I'm trying to add the layer icon just before the radio button in 
LayerReorder form. So here's what i did :
- in ClientLayerReorder.php, I created a getCwLayerIcons() function just 
like getCwLayerIds() wich looks like this

    /    public function getCwLayerIcons() {

            $cwLayerIcons = array();
            $plugin =
    $this->cartoclient->getPluginManager()->getPlugin('layers');

            foreach ($plugin->getLayersInit()->layers as $layer) {
                if ($layer instanceof Layer) {
                     $cwLayerIcons[$layer->id] =
    $plugin->getLayerIcon($layer);
                }
            }
            return $cwLayerIcons;
        }/

- The getLayerIcon() function in ClientLayers.php looks like this

    /public function getLayerIcon($layer) {
            $element = $this->fetchLayer($layer);
            /*$children = $this->getLayerChildren($layer);
            $this->fetchLayerIcon($layer,$children);
            if (empty($element['layerIcon'])) {
                $iconUrl = '';
            } else {
                $resourceHandler =
    $this->getCartoclient()->getResourceHandler();
                $iconUrl =
    $resourceHandler->getFinalUrl($element['layerIcon'], false);
            }*/

            echo($layer->id.": ");
            print_r($element);
            echo "<br><br>\n";
            return $element['layerIcon'];
        }/


My problem is that i can't get the icon filename of my layers. I always 
get an empty string.
Where am I doing something wrong?

Thanks

Simon Ortet



More information about the Cartoweb-users mailing list