0.1.0
0.1.0.0Frontend Text Field with Bootstrap Datepicker for Contao Open Source CMS
LGPL-3.0+
The Requires
by Ulrich-Matthias SchÀfer
contao google places autocomplete address field addresspicker
Frontend Text Field with Bootstrap Datepicker for Contao Open Source CMS
Contao Wrapper for google places autocomplete., (*1)
Comes with a widget for Backend and Frontend., (*2)
For Backend use specify addresspicker
in the dca:, (*3)
$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 ''" );
You can pass the following options to eval:, (*4)
geocode, address, establishment, (regions), (cities)
somefunc
or function(picker){ console.log(picker.getPlace()) }
long_name
or short_name
Make sure you have corresponding fields in your dca.
The fieldname has to be [name of the adresspicker]_[name of the field without use]
.
e.g. componentRestrictions_locality
, (*5)
$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' )
Frontend Text Field with Bootstrap Datepicker for Contao Open Source CMS
LGPL-3.0+
contao google places autocomplete address field addresspicker