/** * Convert the overlay object into a Javascript string. * @return string */ public function toJS() { // set elements into the storage object if ($this->options || $this->events || $this->onces || $this->callback) { // transform class name into gmap3 storage name $name = strtolower(str_replace('EGmap3', null, get_class($this))); $this->{$name} = new EGmap3ObjectBase(); if ($this->options) { $this->{$name}->options = $this->options; $this->options = null; } if ($this->events) { $this->{$name}->events = $this->eventsToJS($this->events); $this->events = null; } if ($this->onces) { $this->{$name}->onces = $this->eventsToJS($this->onces); $this->onces = null; } if ($this->callback) { $this->{$name}->callback = $this->callback; $this->callback = null; } if ($this->data) { $this->{$name}->data = $this->data; $this->data = null; } } return parent::toJS(); }
public function __construct($options = null) { parent::__construct($options); $this->callback = 'js:function(result){if(!result)return;$(this).gmap3({action:"addDirectionsRenderer",options:{draggable:false,directions:result}});}'; }
/** * Create a new action. * @param string An identifier for this style. * @param mixed $options Associative array or Options object */ public function __construct($id, $options = null) { $this->id = $id; parent::__construct($options); }