From f86a0bea5109870bc11a2cef76b5c05f6f51ea67 Mon Sep 17 00:00:00 2001 From: Ian Rothmann Date: Wed, 23 Aug 2017 10:43:49 +0200 Subject: [PATCH] Location --- src/Rocket/RocketFieldSet.php | 10 ++++++++ src/Rocket/Types/RocketField.php | 5 ++++ src/Rocket/Types/RocketLocationField.php | 29 ++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 src/Rocket/Types/RocketLocationField.php diff --git a/src/Rocket/RocketFieldSet.php b/src/Rocket/RocketFieldSet.php index e960a0c..508fbc4 100644 --- a/src/Rocket/RocketFieldSet.php +++ b/src/Rocket/RocketFieldSet.php @@ -20,6 +20,7 @@ use IanRothmann\RocketDataLaravel\Rocket\Types\RocketFilesField; use IanRothmann\RocketDataLaravel\Rocket\Types\RocketImageField; use IanRothmann\RocketDataLaravel\Rocket\Types\RocketImagesField; +use IanRothmann\RocketDataLaravel\Rocket\Types\RocketLocationField; use IanRothmann\RocketDataLaravel\Rocket\Types\RocketLongTextField; use IanRothmann\RocketDataLaravel\Rocket\Types\RocketMultiSelectField; use IanRothmann\RocketDataLaravel\Rocket\Types\RocketNumberField; @@ -116,6 +117,15 @@ public function number($fieldName, $label){ return $this->addField(new RocketNumberField($fieldName,$label)); } + /** + * @param $fieldName + * @param $label + * @return RocketLocationField + */ + public function location($fieldName, $label='Location',$centerLat=null,$centerLong=null){ + return $this->addField(new RocketLocationField($fieldName,$label,$centerLat,$centerLong)); + } + /** * @param $fieldName * @param $label diff --git a/src/Rocket/Types/RocketField.php b/src/Rocket/Types/RocketField.php index 502a4aa..e56bb2a 100644 --- a/src/Rocket/Types/RocketField.php +++ b/src/Rocket/Types/RocketField.php @@ -28,12 +28,17 @@ class RocketField const TYPE_CURRENCY='currency'; const TYPE_SELECT='select'; const TYPE_MULTISELECT='multiselect'; + const TYPE_LOCATION='location'; public static function text($fieldName,$label){ return new RocketTextField($fieldName,$label); } + public static function location($fieldName,$label){ + return new RocketLocationField($fieldName,$label); + } + public static function bool($fieldName, $label, $trueValue='Yes', $falseValue='No'){ return new RocketBoolField($fieldName,$label,$trueValue,$falseValue); } diff --git a/src/Rocket/Types/RocketLocationField.php b/src/Rocket/Types/RocketLocationField.php new file mode 100644 index 0000000..1cf080d --- /dev/null +++ b/src/Rocket/Types/RocketLocationField.php @@ -0,0 +1,29 @@ +centerLat=$centerLat; + $this->centerLng=$centerLng; + } + +} \ No newline at end of file