[Cartoweb-users] Get layers icon in LayerReorder plugin

Oliver Christen oliver.christen at camptocamp.com
Mon Aug 27 02:13:42 EDT 2007


hi

whats the output of the print_r($element); you added?

regards
Oliver



> 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
> 
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>


More information about the Cartoweb-users mailing list