From 2c767547b4be6b0c58e2cd8af9e7a428dc3e3bae Mon Sep 17 00:00:00 2001 From: Michael Jaros Date: Mon, 6 Nov 2017 00:34:58 +0100 Subject: [PATCH] BreakRepeaterFields showcase added, README updated --- .../BreakRepeaterFields.module | 35 +++++++++++++++++++ README.md | 7 ++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 BreakRepeaterFields/BreakRepeaterFields.module diff --git a/BreakRepeaterFields/BreakRepeaterFields.module b/BreakRepeaterFields/BreakRepeaterFields.module new file mode 100644 index 0000000..af7f4b0 --- /dev/null +++ b/BreakRepeaterFields/BreakRepeaterFields.module @@ -0,0 +1,35 @@ + __('BreakRepeaterFields'), + 'summary' => __('Showcase of code breaking repeater fields by calling getExportData. You need to create two repeater fields rep1 and rep2 and two text fields text1 and text2. Install this module, then try adding text1 to rep1 and text2 to rep2.'), + 'version' => 101, + 'singular' => true, + 'autoload' => true + ); + } + + public function init() + { + $this->addHookAfter('ProcessPageView::finished', $this, 'hookProcessPageViewFinished'); + } + + public function hookProcessPageViewFinished() { + $proc=""; + foreach($this->wire('fields') as $field) { + + if($field->name=='rep1'||$field->name=='rep2') { + $proc.=$field->name.", "; + $field->getExportData(); + } + } + $this->wire('session')->message("processed: ".$proc); + + } +} diff --git a/README.md b/README.md index 531216e..56e739b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # pw-autoexport-tf - AutoExportTemplatesAndFields module for ProcessWire ## Installation +CAUTION: This module is not compatible with repeater fields or ProFields. See BUGS. + To install this module manually, simply put it into the site/modules directory of your ProcessWire installation, so that directory should look like this: @@ -33,11 +35,12 @@ The import automatically creates a database backup which can be restored using: ### BUGS - * (#1) This module does not seem to work well together with ProFields or when using -repeater fields. See this forum thread: + * (#1) This module is not compatible with repeater fields or ProFields. See this forum thread: https://processwire.com/talk/topic/13758-autoexporttemplatesandfields-enables-continuous-integration-of-template-and-field-configuration-changes/ + The BreakRepeaterFields module is included in the repository as a minimal showcase of what is breaking the repeater fields. + ## Contact I am looking forward to hearing from you: Contact me