-
Notifications
You must be signed in to change notification settings - Fork 9
Customizing controls
If you want to customize the Google Maps controls, you can simply do this by using the "set_gmap_controls" method.
If you want to customize the map-type control, you can see a list of available style-options here or directly inside the Kohana_Gmap class...
- HORIZONTAL_BAR
- DROPDOWN_MENU
- DEFAULT // This will preserve the best option, depending on the size of your google-map
You can also set a position for displaying the controls.
- TOP
- TOP_LEFT
- TOP_RIGHT
- BOTTOM
- BOTTOM_LEFT
- BOTTOM_RIGHT
- RIGHT
- LEFT
- NULL // This will preserve the default setting
And finally you can tell, if you want the control rendered.
- TRUE
- FALSE
If you want to hide the map-type control:
public function action_index()
{
$map = Gmap::factory();
$this->template->bind('gmap', $map);
$map->set_gmap_controls_maptype(array(
'display' => FALSE,
));
} // function
If you want to show the horizontal-bar and position it at the top:
public function action_index()
{
$map = Gmap::factory();
$this->template->bind('gmap', $map);
$map->set_gmap_controls_maptype(array(
'style' => 'horizontal_bar',
'position' => 'top',
));
} // function
You can set the navigation-control. It's very similar to setting the control for the maptype. Here are the style-types:
- SMALL
- ZOOM_PAN
- ANDROID
- DEFAULT // This will preserve the best option, depending on the size of your google-map
You can also set a position for displaying the controls.
- TOP
- TOP_LEFT
- TOP_RIGHT
- BOTTOM
- BOTTOM_LEFT
- BOTTOM_RIGHT
- RIGHT
- LEFT
- NULL // This will preserve the default setting
And finally you can tell, if you want the control rendered.
- TRUE
- FALSE
If you want to hide the map-type control:
public function action_index()
{
$map = Gmap::factory();
$this->template->bind('gmap', $map);
$map->set_gmap_controls_navigation(array(
'display' => FALSE,
));
} // function
If you want to show the android-buttons and position it at the bottom-left:
public function action_index()
{
$map = Gmap::factory();
$this->template->bind('gmap', $map);
$map->set_gmap_controls_navigation(array(
'style' => 'android',
'position' => 'bottom_left',
));
} // function
Using the scale-control works just like the other control types - Just without the "style" parameter. So you'll just have these options to set:
The position for displaying the controls.
- TOP
- TOP_LEFT
- TOP_RIGHT
- BOTTOM
- BOTTOM_LEFT
- BOTTOM_RIGHT
- RIGHT
- LEFT
- NULL // This will preserve the default setting
And you can set, if you want the control displayed.
- TRUE
- FALSE
public function action_index()
{
$map = Gmap::factory();
$this->template->bind('gmap', $map);
$map->set_gmap_controls_scale(array(
'display' => TRUE,
'position' => 'bottom_left',
));
} // function
You can set all controls within one method call! This is done by:
public function action_index()
{
$map = Gmap::factory();
$this->template->bind('gmap', $map);
$map->set_gmap_controls(array(
'maptype' => array(
'display' => TRUE,
'style' => 'horizontal_bar',
),
'scale' => array(
'display' => FALSE,
),
));
} // function