Hi
It should be allright.
getLayersInit() is used in the layers plugin because everything is based on
the original list of plugin and it is used as a basic references for all
treatments in that coreplugin.
(beside, I have the feeling $plugin->getLayersInit()->layers are string when
$plugin->getLayers() are objects, maybe that was your problem)
Since you are using the layers from another plugin, you can simple suppose
the layers plugin has it right and dont worry about it.
regards
Oliver
Hello
It was to check the values i got.
But finally i found a way :
In getCwLayerIds and my new function getCwLayerIcons i make a
foreach ($plugin->getLayers() as $layer) {
instead of
foreach ($plugin->getLayersInit()->layers as $layer)
so i can get $layer->icon
Seems to work fine, i just hope i didn't create a mess by modifing
getCwLayerIds function...
Simon Ortet
Silogic
Oliver Christen a écrit :
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
[email protected]
http://lists.maptools.org/mailman/listinfo/cartoweb-users
_______________________________________________
Cartoweb-users mailing list
[email protected]
http://lists.maptools.org/mailman/listinfo/cartoweb-users