示例#1
0
文件: Popup.php 项目: josemrc/ae2web
 /**
  * {@inheritdoc}
  */
 public function preBuild(array &$build, ObjectInterface $context = NULL)
 {
     parent::preBuild($build, $context);
     $layers = $this->getOption('layers', array());
     $map_layers = $context->getObjects('layer');
     // Only handle layers available in the map and configured in the control.
     // Ensures maximum performance on client side while having maximum
     // configuration flexibility.
     $frontend_layers = array();
     foreach ($map_layers as $map_layer) {
         if (isset($layers[$map_layer->getMachineName()])) {
             $frontend_layers[$map_layer->getMachineName()] = $map_layer->getMachineName();
         }
     }
     // Don't name these "layers" otherwise Object::getJS() will delete the
     // option from the JS array.
     $this->setOption('frontend_layers', $frontend_layers);
 }