From 0248658908ffe9126c893d573c7817f638097455 Mon Sep 17 00:00:00 2001 From: andriyun Date: Mon, 1 Feb 2016 01:18:19 +0200 Subject: [PATCH] Convert hook_element_info. initial commmit --- d8/modules/custom/dmaps/dmaps.libraries.yml | 8 +++ d8/modules/custom/dmaps/src/Element/Gmap.php | 52 +++++++++++++++++++ .../custom/dmaps/src/Element/GmapAddress.php | 43 +++++++++++++++ .../dmaps/src/Element/GmapDimension.php | 49 +++++++++++++++++ .../custom/dmaps/src/Element/GmapLatitude.php | 39 ++++++++++++++ .../custom/dmaps/src/Element/GmapLatlon.php | 39 ++++++++++++++ .../dmaps/src/Element/GmapLongitude.php | 38 ++++++++++++++ .../dmaps/src/Element/GmapMacrotext.php | 43 +++++++++++++++ .../dmaps/src/Element/GmapMarkerchooser.php | 38 ++++++++++++++ .../dmaps/src/Element/GmapOverlayEdit.php | 41 +++++++++++++++ .../custom/dmaps/src/Element/GmapStyle.php | 40 ++++++++++++++ 11 files changed, 430 insertions(+) create mode 100644 d8/modules/custom/dmaps/dmaps.libraries.yml create mode 100644 d8/modules/custom/dmaps/src/Element/Gmap.php create mode 100644 d8/modules/custom/dmaps/src/Element/GmapAddress.php create mode 100644 d8/modules/custom/dmaps/src/Element/GmapDimension.php create mode 100644 d8/modules/custom/dmaps/src/Element/GmapLatitude.php create mode 100644 d8/modules/custom/dmaps/src/Element/GmapLatlon.php create mode 100644 d8/modules/custom/dmaps/src/Element/GmapLongitude.php create mode 100644 d8/modules/custom/dmaps/src/Element/GmapMacrotext.php create mode 100644 d8/modules/custom/dmaps/src/Element/GmapMarkerchooser.php create mode 100644 d8/modules/custom/dmaps/src/Element/GmapOverlayEdit.php create mode 100644 d8/modules/custom/dmaps/src/Element/GmapStyle.php diff --git a/d8/modules/custom/dmaps/dmaps.libraries.yml b/d8/modules/custom/dmaps/dmaps.libraries.yml new file mode 100644 index 00000000..52c049bc --- /dev/null +++ b/d8/modules/custom/dmaps/dmaps.libraries.yml @@ -0,0 +1,8 @@ +dmaps.gmap: + version: VERSION +dmaps.gmap_macrotext: + version: VERSION +dmaps.gmap_overlay_edit: + version: VERSION +dmaps.gmap_address: + version: VERSION diff --git a/d8/modules/custom/dmaps/src/Element/Gmap.php b/d8/modules/custom/dmaps/src/Element/Gmap.php new file mode 100644 index 00000000..90756578 --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/Gmap.php @@ -0,0 +1,52 @@ + FALSE, + // @todo: Need include default settings. + //'#gmap_settings' => array_merge(gmap_defaults(), [ + '#gmap_settings' => [ + 'points' => [], + 'pointsOverlays' => [], + 'lines' => [], + ], + '#attached' => [ + 'library' => ['dmap/gmap'], + ], + '#pre_render' => [ + [$class, 'preRenderMap'], + ], + '#theme' => 'gmap', + ]; + } + + /** + * Pre render function to make sure all required JS is available. + * + * Depending on the display's behavior. + */ + function preRenderMap($element) { + // @todo Converted _gmap_pre_render_map function should be here. + return $element; + } + +} +?> diff --git a/d8/modules/custom/dmaps/src/Element/GmapAddress.php b/d8/modules/custom/dmaps/src/Element/GmapAddress.php new file mode 100644 index 00000000..6704b48a --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/GmapAddress.php @@ -0,0 +1,43 @@ + TRUE, + '#pre_render' => [ + [$class, 'processAddress'], + ], + '#attached' => [ + 'library' => ['dmaps/gmap_address'], + ], + '#autocomplete_path' => '', + '#theme' => 'textfield', + ]; + } + + /** + * Style fieldset #process function. + */ + function processAddress($element) { + // @todo Converted process_gmap_address function should be here. + return $element; + } + +} +?> diff --git a/d8/modules/custom/dmaps/src/Element/GmapDimension.php b/d8/modules/custom/dmaps/src/Element/GmapDimension.php new file mode 100644 index 00000000..f01e0a33 --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/GmapDimension.php @@ -0,0 +1,49 @@ + TRUE, + '#gmap_newtype' => 'textfield', + '#process' => [ + [$class, 'processGmapControl'], + ], + '#element_validate' => [ + [$class, 'dimensionValidate'], + ], + ]; + } + + /** + * Generic gmap control #process function. + */ + function processGmapControl($element, &$form_state, $complete_form) { + // @todo Converted process_gmap_control function should be here. + return $element; + } + + /** + * Ensure a textfield is a valid css dimension string. + */ + function dimensionValidate(&$elem, &$form_state) { + // @todo Converted gmap_dimension_validate function should be here. + } + +} +?> diff --git a/d8/modules/custom/dmaps/src/Element/GmapLatitude.php b/d8/modules/custom/dmaps/src/Element/GmapLatitude.php new file mode 100644 index 00000000..bc05cd5a --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/GmapLatitude.php @@ -0,0 +1,39 @@ + TRUE, + '#gmap_newtype' => 'textfield', + '#process' => [ + [$class, 'processGmapControl'], + ], + ]; + } + + /** + * Generic gmap control #process function. + */ + function processGmapControl($element, &$form_state, $complete_form) { + // @todo Converted process_gmap_control function should be here. + return $element; + } + +} +?> diff --git a/d8/modules/custom/dmaps/src/Element/GmapLatlon.php b/d8/modules/custom/dmaps/src/Element/GmapLatlon.php new file mode 100644 index 00000000..c9126fbe --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/GmapLatlon.php @@ -0,0 +1,39 @@ + TRUE, + '#gmap_newtype' => 'textfield', + '#process' => [ + [$class, 'processGmapControl'], + ], + ]; + } + + /** + * Generic gmap control #process function. + */ + function processGmapControl($element, &$form_state, $complete_form) { + // @todo Converted process_gmap_control function should be here. + return $element; + } + +} +?> diff --git a/d8/modules/custom/dmaps/src/Element/GmapLongitude.php b/d8/modules/custom/dmaps/src/Element/GmapLongitude.php new file mode 100644 index 00000000..f704b108 --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/GmapLongitude.php @@ -0,0 +1,38 @@ + TRUE, + '#gmap_newtype' => 'textfield', + '#process' => [ + [$class, 'processGmapControl'], + ], + ]; + } + + /** + * Generic gmap control #process function. + */ + function processGmapControl($element, &$form_state, $complete_form) { + // @todo Converted process_gmap_control function should be here. + return $element; + } +} +?> diff --git a/d8/modules/custom/dmaps/src/Element/GmapMacrotext.php b/d8/modules/custom/dmaps/src/Element/GmapMacrotext.php new file mode 100644 index 00000000..3f8500a1 --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/GmapMacrotext.php @@ -0,0 +1,43 @@ + TRUE, + '#gmap_newtype' => 'textarea', + '#process' => [ + [$class, 'processGmapControl'], + ], + '#attached' => [ + 'library' => ['dmap/gmap_macrotext'], + ], + '#theme' => 'textarea', + ]; + } + + /** + * Generic gmap control #process function. + */ + function processGmapControl($element, &$form_state, $complete_form) { + // @todo Converted process_gmap_control function should be here. + return $element; + } + +} +?> diff --git a/d8/modules/custom/dmaps/src/Element/GmapMarkerchooser.php b/d8/modules/custom/dmaps/src/Element/GmapMarkerchooser.php new file mode 100644 index 00000000..e518c320 --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/GmapMarkerchooser.php @@ -0,0 +1,38 @@ + TRUE, + '#process' => [ + [$class, 'process_gmap_markerchooser'], + ], + ]; + } + + /** + * Marker chooser #process function. + */ + function processGmapMarkerchooser($element) { + // @todo Converted process_gmap_markerchooser function should be here. + return $element; + } + +} +?> diff --git a/d8/modules/custom/dmaps/src/Element/GmapOverlayEdit.php b/d8/modules/custom/dmaps/src/Element/GmapOverlayEdit.php new file mode 100644 index 00000000..8040159e --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/GmapOverlayEdit.php @@ -0,0 +1,41 @@ + TRUE, + '#process' => [ + [$class, 'processGmapOverlayEdit'], + ], + '#attached' => [ + 'library' => ['dmaps/gmap_overlay_edit'], + ], + ]; + } + + /** + * Generic gmap_overlay_edit #process function. + */ + function processGmapOverlayEdit($element, &$form_state, $complete_form) { + // @todo Converted process_gmap_overlay_edit function should be here. + return $element; + } + +} +?> diff --git a/d8/modules/custom/dmaps/src/Element/GmapStyle.php b/d8/modules/custom/dmaps/src/Element/GmapStyle.php new file mode 100644 index 00000000..5d755322 --- /dev/null +++ b/d8/modules/custom/dmaps/src/Element/GmapStyle.php @@ -0,0 +1,40 @@ + TRUE, + '#tree' => TRUE, + '#gmap_style_type' => 'poly', + '#process' => [ + [$class, 'processStyle'], + ], + ]; + } + + /** + * Style fieldset #process function. + */ + function processStyle($element) { + // @todo Converted process_gmap_style function should be here. + return $element; + } + +} +?>