Skip to content

Commit f8233ce

Browse files
committed
Version 2.0.1
Improved detection of nested repeaters.
1 parent 42bf61f commit f8233ce

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

InputfieldRepeaterMatrixDuplicate.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @website www.flipzoom.de
55
* @create 2019-03-26
66
* @updated 2020-09-17
7+
* @updated 2020-10-01
78
* @style Tab size: 4 / Soft tabs: YES
89
* ----------------------------------------------------------------------------------
910
* @licence
@@ -83,8 +84,10 @@ $(window).on('load', function(){
8384
// ------------------------------------------------------------------------
8485
// Dont bind events and remove function if source matrix item is a
8586
// nested repeater. Nested repeaters are currently not supported!
87+
// Note: the module cannot be loaded if the repeater field ends with the
88+
// name "repeater" or "reapter12", etc.
8689
// ------------------------------------------------------------------------
87-
if($(this).closest('.InputfieldRepeaterItem').attr('data-rmd-target-field').match(/repeater[\w-]*\b$/g)) {
90+
if($(this).closest('.InputfieldRepeaterItem').attr('data-rmd-target-field').match(/repeater[\d-]{2,}\b$/g)) {
8891
$(this).remove();
8992

9093
} else {

InputfieldRepeaterMatrixDuplicate.module

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @website www.flipzoom.de
77
* @create 2019-03-26
88
* @updated 2020-09-17
9+
* @updated 2020-10-01
910
* @style Tab size: 4 / Soft tabs: YES
1011
* ----------------------------------------------------------------------------------
1112
* @licence
@@ -44,7 +45,7 @@ class InputfieldRepeaterMatrixDuplicate extends WireData implements Module, Conf
4445
'summary' => __('With this module you can duplicate multible RepeaterMatrix-Items from one page to another which has the same matrix field. Please check the Read Me for restrictions.', __FILE__),
4546
'author' => 'David Karich - FlipZoom Media Inc.',
4647
'href' => 'https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate',
47-
'version' => 200,
48+
'version' => 201,
4849
'autoload' => 'template=admin',
4950
'singular' => true,
5051
'icon' => 'clipboard',

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ This module extends the commercial ProModule "[RepeaterMatrix](https://processwi
2626
- No support for nested repeater items. Currently only first level items can be duplicated. Means a repeater field in a repeater field cannot be duplicated. Workaround: simply duplicate the parent item
2727
- Dynamic reloading and adding of repeater items cannot be registered. Several interfaces and events from the core are missing. The initialization occurs only once after the page load event
2828

29+
## Attention, please note!
30+
Nested repeaters cannot be supported technically. Therefore a check is made to prevent this. However, a nested repeater can only be detected if the field name ends for example with ` _repeater1234`. For example, if your MatrixRepeater field is named like this: `content_repeater` or `content_repeater123`, this field is identified as nested and the module does not load. In version 2.0.1 the identification has been changed so that a field ending with the name `repeater` is only detected as nested if at least a two-digit number sequence follows. **But to avoid this problem completely, make sure that your repeater matrix field does NOT end with the name "repeater".**
31+
2932
### Changelog
33+
2.0.1
34+
- Bug fix: Thanks to [@ngrmm](https://processwire.com/talk/profile/3649-ngrmm/) I could discover a bug which causes that the module cannot be loaded if the MatrixRepeater field ends with the name "repeater". The code was adjusted and information about the problem was provided.
35+
3036
2.0.0
3137
- Feature: Copy multiple items at once! The fundament for copying multiple items was created by [@Autofahrn](https://processwire.com/talk/profile/5384-autofahrn/) - THX!
3238
- Feature: Optionally you can disable the copy and/or paste dialog

0 commit comments

Comments
 (0)