-
Notifications
You must be signed in to change notification settings - Fork 31
add google places helper #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Add a helper for google places and add libraries options to google Map helper
* | ||
* @return string divContainer | ||
*/ | ||
public function input( $fieldName, array $fieldOptions = [], $googleOptions = [] ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for BC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would like to use the same methods as FormHelper
I can remove this or add @deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the tag suffices :)
* | ||
* @return string divContainer | ||
*/ | ||
public function control( $fieldName, $fieldOptions = [], $googleOptions = [] ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arrays should have typehints
also please check CS issues
* @param $id string the id of the input field | ||
* @param array $options associative array of settings for places.Autocomplete | ||
*/ | ||
private function _script( $id, $options = [] ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected and array typehint
//http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js | ||
} | ||
// still not very common: http://code.google.com/intl/de-DE/apis/maps/documentation/javascript/basics.html | ||
if (false && !empty($this->_runtimeConfig['autoScript']) && !$this->_gearsIncluded) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if false => we can remove this part then?
@@ -112,6 +111,8 @@ function initialize() { | |||
|
|||
$script = 'jQuery(document).ready(function() {' . $js . '});'; | |||
|
|||
$this->Html->scriptBlock($script, ['block' => true]); | |||
$this->Html->scriptBlock( $script, [ 'block' => true ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should run the sniffer instead as documented, this is all invalid CS :)
Sure you can the |
i had included codesniffer standard psr2 into phpStorm. the composer commands are new for me. Looks like these are other standards. |
* @return string divContainer | ||
*/ | ||
public function control($fieldName, array $fieldOptions = [], array $googleOptions = []) { | ||
$id = isset($fieldOptions['id']) && $fieldOptions['id'] != '' ? $fieldOptions['id'] : $fieldName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!empty(fieldOptions['id']) is shorter than both checks. 0 is not a valid id anyway right?
|
||
$html = $this->Form->control($fieldName, $fieldOptions); | ||
$html .= $this->Form->hidden("{$fieldName}_lat", ['id' => "{$id}_lat"]); | ||
$html .= $this->Form->hidden("{$fieldName}_lon", ['id' => "{$id}_lon"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lng is usually used for longitude shortform in this plugin.
Can we have a small test for the new functionality and helper? |
I will have a look at your cakephp-sandbox and build some example later at home. |
Any update here? |
ping @mh-SimTEC |
Add a helper for google places and add libraries options to google Map helper
I don't know if i have fully understand how you include the google api.