diff --git a/readme.md b/readme.md index d718b9f..2bde44c 100644 --- a/readme.md +++ b/readme.md @@ -70,7 +70,6 @@ First we should create the fields classes and the test cases. After we have to s - Implement the `Flexible Content` field with unit tests (done!); - Improve performance. Currently the plugin makes one SQL query for each field. This goal is to improve that using `whereIn()` clauses. - Some fields are still missing (check table below and contribute). ## Fields @@ -96,7 +95,7 @@ First we should create the fields classes and the test cases. After we have to s | Relationship | ok | [@jgrossi](http://github.com/jgrossi) | `Corcel\Post` or `Collection` of `Post` | | Taxonomy | ok | [@jgrossi](http://github.com/jgrossi) | `Corcel\Term` or `Collection` of `Term` | | User | ok | [@jgrossi](http://github.com/jgrossi) | `Corcel\User` | -| Google Map | missing | | +| Google Map | ok | [@naeemz](http://github.com/naeemz) | `array` | | Date Picker | ok | [@jgrossi](http://github.com/jgrossi) | `Carbon\Carbon` | | Date Time Picker | ok | [@jgrossi](http://github.com/jgrossi) | `Carbon\Carbon` | | Time Picker | ok | [@jgrossi](http://github.com/jgrossi) | `Carbon\Carbon` | diff --git a/src/Field/GoogleMap.php b/src/Field/GoogleMap.php new file mode 100644 index 0000000..ae387a9 --- /dev/null +++ b/src/Field/GoogleMap.php @@ -0,0 +1,34 @@ + + */ +class GoogleMap extends BasicField implements FieldInterface +{ + /** + * @var Array + */ + protected $cords; + + /** + * @param string $fieldName + */ + public function process($fieldName) + { + $this->cords = $this->fetchValue($fieldName); + } + + /** + * @return Array + */ + public function get() + { + return $this->cords; + } +} diff --git a/src/FieldFactory.php b/src/FieldFactory.php index 13d881f..0d616ce 100644 --- a/src/FieldFactory.php +++ b/src/FieldFactory.php @@ -6,6 +6,7 @@ use Corcel\Acf\Field\DateTime; use Corcel\Acf\Field\File; use Corcel\Acf\Field\Gallery; +use Corcel\Acf\Field\GoogleMap; use Corcel\Acf\Field\Image; use Corcel\Acf\Field\PageLink; use Corcel\Acf\Field\PostObject; @@ -107,6 +108,9 @@ public static function make($name, Model $post, $type = null) case 'flexible_content': $field = new FlexibleContent($post); break; + case 'google_map': + $field = new GoogleMap($post); + break; default: return null; }