public function finalize($return = false) {
		$script = $this->_arrayToObject('matching', $this->matching, false, true) . PHP_EOL;
		$script .= $this->_arrayToObject('gIcons' . static::$mapCount, $this->icons, false, false) . '

	jQuery(document).ready(function() {
		';

		$script .= $this->map;
		if ($this->_runtimeConfig['geolocate']) {
			$script .= $this->_geolocate();
		}

		if ($this->_runtimeConfig['showMarker'] && !empty($this->markers) && is_array($this->markers)) {
			$script .= implode($this->markers, ' ');
		}

		if ($this->_runtimeConfig['autoCenter']) {
			$script .= $this->_autoCenter();
		}
		$script .= '

	});';
		static::$mapCount++;
		if ($return) {
			return $script;
		}
		$this->Html->scriptBlock($script, ['block' => true]);
	}
public function finalize($return = false) {
		$script = $this->_arrayToObject('matching', $this->matching, false, true) . PHP_EOL;
		$script .= $this->_arrayToObject('gIcons' . static::$mapCount, $this->icons, false, false) . '

	jQuery(document).ready(function() {
		';

		$script .= $this->map;
		if ($this->_runtimeConfig['geolocate']) {
			$script .= $this->_geolocate();
		}

		if ($this->_runtimeConfig['showMarker'] && !empty($this->markers) && is_array($this->markers)) {
			$script .= implode($this->markers, ' ');
		}

		if ($this->_runtimeConfig['autoCenter']) {
			$script .= $this->_autoCenter();
		}
		$script .= '

	});';
		static::$mapCount++;
		if ($return) {
			return $script;
		}
		$this->Html->scriptBlock($script, ['block' => true]);
	}
public function finalize ( $ return = false ) { $ script = $ this -> _arrayToObject ( 'matching' , $ this -> matching , false , true ) . PHP_EOL ; $ script .= $ this -> _arrayToObject ( 'gIcons' . static :: $ mapCount , $ this -> icons , false , false ) . '

	jQuery(document).ready(function() {
		' ; $ script .= $ this -> map ; if ( $ this -> _runtimeConfig [ 'geolocate' ] ) { $ script .= $ this -> _geolocate ( ) ; } if ( $ this -> _runtimeConfig [ 'showMarker' ] && ! empty ( $ this -> markers ) && is_array ( $ this -> markers ) ) { $ script .= implode ( $ this -> markers , ' ' ) ; } if ( $ this -> _runtimeConfig [ 'autoCenter' ] ) { $ script .= $ this -> _autoCenter ( ) ; } $ script .= '

	});' ; static :: $ mapCount ++ ; if ( $ return ) { return $ script ; } $ this -> Html -> scriptBlock ( $ script , [ 'block' => true ] ) ; }
Finalize the map and write the javascript to the buffer.
Make sure that your view does also output the buffer at some place!

@param bool $return If the output should be returned instead
@return null|string Javascript if $return is true
Finalize the map and write the javascript to the buffer . Make sure that your view does also output the buffer at some place!