public function renderJavascripts(Autocomplete $autocomplete)
    {
        $output = array();

        if (!$this->apiHelper->isLoaded() && !$autocomplete->isAsync()) {
            $output[] = $this->apiHelper->render($autocomplete->getLanguage(), array('places'));
        }

        $output[] = '<script type="text/javascript">'.PHP_EOL;

        if ($autocomplete->isAsync()) {
            $output[] = 'function load_ivory_google_place () {'.PHP_EOL;
        }

        if ($autocomplete->hasBound()) {
            if (!$autocomplete->getBound()->hasCoordinates()) {
                throw HelperException::invalidAutocompleteBound();
            }

            $output[] = $this->coordinateHelper->render($autocomplete->getBound()->getSouthWest());
            $output[] = $this->coordinateHelper->render($autocomplete->getBound()->getNorthEast());
            $output[] = $this->boundHelper->render($autocomplete->getBound());
        }

        $output[] = $this->renderAutocomplete($autocomplete);

        if ($autocomplete->isAsync()) {
            $output[] = '}'.PHP_EOL;
        }

        $output[] = '</script>'.PHP_EOL;

        if (!$this->apiHelper->isLoaded() && $autocomplete->isAsync()) {
            $output[] = $this->apiHelper->render(
                $autocomplete->getLanguage(),
                array('places'),
                'load_ivory_google_place'
            );
        }

        return implode('', $output);
    }
public function renderJavascripts(Autocomplete $autocomplete)
    {
        $output = array();

        if (!$this->apiHelper->isLoaded() && !$autocomplete->isAsync()) {
            $output[] = $this->apiHelper->render($autocomplete->getLanguage(), array('places'));
        }

        $output[] = '<script type="text/javascript">'.PHP_EOL;

        if ($autocomplete->isAsync()) {
            $output[] = 'function load_ivory_google_place () {'.PHP_EOL;
        }

        if ($autocomplete->hasBound()) {
            if (!$autocomplete->getBound()->hasCoordinates()) {
                throw HelperException::invalidAutocompleteBound();
            }

            $output[] = $this->coordinateHelper->render($autocomplete->getBound()->getSouthWest());
            $output[] = $this->coordinateHelper->render($autocomplete->getBound()->getNorthEast());
            $output[] = $this->boundHelper->render($autocomplete->getBound());
        }

        $output[] = $this->renderAutocomplete($autocomplete);

        if ($autocomplete->isAsync()) {
            $output[] = '}'.PHP_EOL;
        }

        $output[] = '</script>'.PHP_EOL;

        if (!$this->apiHelper->isLoaded() && $autocomplete->isAsync()) {
            $output[] = $this->apiHelper->render(
                $autocomplete->getLanguage(),
                array('places'),
                'load_ivory_google_place'
            );
        }

        return implode('', $output);
    }
public function renderJavascripts ( Autocomplete $ autocomplete ) { $ output = array ( ) ; if ( ! $ this -> apiHelper -> isLoaded ( ) && ! $ autocomplete -> isAsync ( ) ) { $ output [ ] = $ this -> apiHelper -> render ( $ autocomplete -> getLanguage ( ) , array ( 'places' ) ) ; } $ output [ ] = '<script type="text/javascript">' . PHP_EOL ; if ( $ autocomplete -> isAsync ( ) ) { $ output [ ] = 'function load_ivory_google_place () {' . PHP_EOL ; } if ( $ autocomplete -> hasBound ( ) ) { if ( ! $ autocomplete -> getBound ( ) -> hasCoordinates ( ) ) { throw HelperException :: invalidAutocompleteBound ( ) ; } $ output [ ] = $ this -> coordinateHelper -> render ( $ autocomplete -> getBound ( ) -> getSouthWest ( ) ) ; $ output [ ] = $ this -> coordinateHelper -> render ( $ autocomplete -> getBound ( ) -> getNorthEast ( ) ) ; $ output [ ] = $ this -> boundHelper -> render ( $ autocomplete -> getBound ( ) ) ; } $ output [ ] = $ this -> renderAutocomplete ( $ autocomplete ) ; if ( $ autocomplete -> isAsync ( ) ) { $ output [ ] = '}' . PHP_EOL ; } $ output [ ] = '</script>' . PHP_EOL ; if ( ! $ this -> apiHelper -> isLoaded ( ) && $ autocomplete -> isAsync ( ) ) { $ output [ ] = $ this -> apiHelper -> render ( $ autocomplete -> getLanguage ( ) , array ( 'places' ) , 'load_ivory_google_place' ) ; } return implode ( '' , $ output ) ; }
Renders the autocomplete javascripts.

@param \Ivory\GoogleMap\Places\Autocomplete $autocomplete The autocomplete.

@throws \Ivory\GoogleMap\Exception\HelperException if the autocomplete bound does not have coordinates.

@return string The HTML output.
Renders the autocomplete javascripts .