模糊匹配 / contao-addresspicker
Contao开源CMS的Bootstrap日期选择器前端文本字段
0.1.1
2016-08-03 13:41 UTC
Requires
- php: >=5.3.2
This package is not auto-updated.
Last update: 2024-09-14 18:31:36 UTC
README
谷歌地点自动完成Contao包装器。
包含后端和前端的小部件。
后端使用时,在dca中指定addresspicker
$GLOBALS['TL_DCA']['tl_form_field']['fields']['componentRestrictions'] = array ( 'label' => &$GLOBALS['TL_LANG']['tl_form_field']['componentRestrictions'], 'exclude' => true, 'inputType' => 'addresspicker', 'eval' => array('category' => '(regions)', 'tl_class'=>'w50'}'), 'sql' => "varchar(255) NOT NULL default ''" );
您可以传递以下选项到eval
- category:
geocode, address, establishment, (regions), (cities)
中的一个 - componentRestrictions: 限制选择器的国家代码
- bounds: 选择器受限矩形的纬度和经度:1.223,12.421;4.23,1.213
- callback: 选择地点时调用的JavaScript函数名或函数声明(
somefunc
或function(picker){ console.log(picker.getPlace()) }
) - 选择地点时希望填充的字段。可用字段包括
- use_route
- use_street_number
- use_locality
- use_administrative_area_level_1
- use_country
- use_postal_code
- use_lat_long
- 为每个use-field指定类型以指定
long_name
或short_name
- use_route_type
- use_street_number_type
- use_locality_type
- use_administrative_area_level_1_type
- use_country_type
- use_postal_code_type
确保您的dca中存在相应的字段。字段名必须是 [addresspicker名称]_[字段名称]
。例如 componentRestrictions_locality
$GLOBALS['TL_DCA']['tl_form_field']['fields']['componentRestrictions'] = array ( 'label' => &$GLOBALS['TL_LANG']['tl_form_field']['componentRestrictions'], 'exclude' => true, 'inputType' => 'addresspicker', 'eval' => array( 'callback' => 'function(a){console.log(a.getPlace())}', 'category' => '(regions)', 'tl_class' => 'w50', 'use_locality' => true, 'use_locality_type' => 'long_name' ), 'sql' => "varchar(255) NOT NULL default ''" ); // this field is filled automatically when a place is selected $GLOBALS['TL_DCA']['tl_form_field']['fields']['componentRestrictions_locality`'] = array( inputType => 'text' )