Changeset 3240 for trunk/modules

Show
Ignore:
Timestamp:
07/30/2008 04:42:43 PM (4 months ago)
Author:
alexsancho
Message:

added extra param to render method allowing to pass additional fields to the template

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/gmaps/libraries/Gmap.php

    r3216 r3240  
    312312         * 
    313313         * @param string $template template name 
     314         * @param array $extra extra fields passed to the template 
    314315         * @return string 
    315316         */ 
    316         public function render($template = 'gmaps/javascript') 
     317        public function render($template = 'gmaps/javascript', $extra = array()) 
    317318        { 
    318319                // Latitude, longitude, zoom and default map type 
     
    342343                // Map centering 
    343344                $center = 'map.setCenter(new google.maps.LatLng('.$lat.', '.$lon.'), '.$zoom.', '.$default_type.');'; 
    344  
    345                 // Render the Javascript 
    346                 return View::factory($template, array 
     345                 
     346                $data = array_merge($extra, array 
    347347                        ( 
    348348                                'map' => $map, 
     
    352352                                'icons' => $this->icons, 
    353353                                'markers' => $this->markers, 
    354                         )) 
    355                         ->render(); 
     354                        )); 
     355 
     356                // Render the Javascript 
     357                return View::factory($template, $data)->render(); 
    356358        } 
    357359