Jump to content

Recommended Posts

ProcessWire InputfieldRepeaterMatrixDuplicate

Thanks to the great ProModule "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use a content module on a different page (e.g. in the same design), you have to rebuild each item manually every time.

This module extends the commercial ProModule "RepeaterMatrix" by the function to duplicate repeater items from one page to another page. The condition is that the target field is the same matrix field from which the item is duplicated. This module is currently understood as proof of concept. There are a few limitations that need to be considered. The intention of the module is that this functionality is integrated into the core of RepeaterMatrix and does not require an extra module.

Check out the screencast

What the module can do

  • Duplicate a repeater item from one page to another
  • No matter how complex the item is
  • Full support for file and image fields
  • Multilingual support
  • Support of Min and Max settings
  • Live synchronization of clipboard between multiple browser tabs. Copy an item and simply switch the browser tab to the target page and you will immediately see the past button
  • Support of multiple RepeaterMatrix fields on one page
  • Configurable which roles and fields are excluded
  • Duplicated items are automatically pasted to the end of the target field and set to hidden status so that changes are not directly published
  • Automatic clipboard update when other items are picked
  • Automatically removes old clipboard data if it is not pasted within 6 hours
  • Delete clipboard itself by clicking the selected item again
  • Benefit: unbelievably fast workflow and content replication

What the module can't do

  • Before an item can be duplicated in its current version, the source page must be saved. This means that if you make changes to an item and copy this, the old saved state will be duplicated
  • Dynamic loading is currently not possible. Means no AJAX. When pasting, the target page is saved completely
  • 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
  • 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

Changelog
1.0.4

  • Bug fix: Various bug fixes and improvements in live synchronization
  • Bug fix: Items are no longer inserted when the normal save button is clicked. Only when the past button is explicitly clicked
  • Feature: Support of multiple repeater fields in one page
  • Feature: Support of repeater Min/Max settings
  • Feature: Configurable roles and fields
  • Enhancement: Improved clipboard management
  • Enhancement: Documentation improvement
  • Enhancement: Corrected few typos #1

1.0.3

  • Feature: Live synchronization
  • Enhancement: Load the module only in the backend
  • Enhancement: Documentation improvement

1.0.2

  • Bug fix: Various bug fixes and improvements in JS functions
  • Enhancement: Documentation improvement
  • Enhancement: Corrected few typos

1.0.1

  • Bug fix: Various bug fixes and improvements in the duplication process

1.0.0

  • Initial release

Support this module

If this module is useful for you, I am very thankful for your small donation: Donate 5,- Euro (via PayPal – or an amount of your choice. Thank you!)

Download this module

> Github: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate
> PW module directory: – soon –

Edited by David Karich
Version update 1.0.4
  • Like 18
  • Thanks 1

Share this post


Link to post
Share on other sites

Wow, that's awesome.

Yes, this would be great to have in the RM core indeed.

btw: How did you build the CKE dropdown for lorem ipsum paragraphs?

Share this post


Link to post
Share on other sites
8 minutes ago, kongondo said:

Nice! 

What admin theme is that?

AdminTheme Boss with some customizations. 😊

  • Like 2

Share this post


Link to post
Share on other sites

WOW!! Jaw dropped here... I'm really impressed, David! This module and the admin settings you built look incredible.

Dumb question: how did you create those matrix thumbnails?

  • Like 2

Share this post


Link to post
Share on other sites

Nice! We know what you were doing in the last few months 🙂

  • Like 1

Share this post


Link to post
Share on other sites

Awesome!! I'm also interested in how you changed the Repeater Matrix labels to images 🙂

Share this post


Link to post
Share on other sites

I guess it's just CSS?

a.InputfieldRepeaterAddLink.InputfieldRepeaterMatrixAddLink.InputfieldRepeaterAddLinkInit[data-type="3"] {
	font-size: 0;
	width: 150px;
	height: 100px;
	display: inline-block;
	background-image: url(https://via.placeholder.com/150);
	background-repeat: no-repeat;
}

span.ui-priority-secondary {
	display: none;
}

 

  • Like 7

Share this post


Link to post
Share on other sites
44 minutes ago, dragan said:

I guess it's just CSS?


a.InputfieldRepeaterAddLink.InputfieldRepeaterMatrixAddLink.InputfieldRepeaterAddLinkInit[data-type="3"] {
	font-size: 0;
	width: 150px;
	height: 100px;
	display: inline-block;
	background-image: url(https://via.placeholder.com/150);
	background-repeat: no-repeat;
}

span.ui-priority-secondary {
	display: none;
}

 

Exactly. It's just a bit custom CSS. 👍 It might also be an idea for a matrix update that you can configure labels as images.  Would be more flexible.

  • Like 4

Share this post


Link to post
Share on other sites
1 minute ago, David Karich said:

It might also be an idea for a matrix update that you can configure labels as images.  Would be more flexible.

Yep. And add a nice touch to convert automagically label/link-texts to title attributes, so when the author hovers over an image, he knows exactly what kind of matrix item he/she will add.

  • Like 2

Share this post


Link to post
Share on other sites

I have started a topic in Repeater Matrix closed support board with a request to make it possible to override InputfieldRepeaterMatrix::renderFooter method in a hook. This way we can probably implement any kind of add content type design without css overrides.

  • Like 3

Share this post


Link to post
Share on other sites

Version Update 1.0.3

The current version 1.0.3 has some minor improvements. Items are inserted at the last position on the target page and set to the status unpublished. Furthermore, the clipboard is synchronized live, so you can jump between browser tabs without reloading the target page, for direct pasting. And the module runs only in the backend in the autoload.

> Grap a copy: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDublicate

Edited by David Karich
Version Update 1.0.3
  • Like 3

Share this post


Link to post
Share on other sites

Version Update 1.0.4

The current version has got some improvements, bug fixes and new features. Meanwhile a bit further than just a proof of concept. I would call it a beta version. I now submit it to the PW directory.

IMPORTANT for an update from older versions: completely uninstall and delete the old versions! Only then install the new version.

All information and downloads are updated in the first post.

@kongondo Can you please move this topic under "Modules"? I think the module is out of development. Thanks a lot.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, David Karich said:

@kongondo Can you please move this topic under "Modules"? I think the module is out of development. Thanks a lot.

Done 🙂

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By dimitrios
      Hello,
      this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page.
      To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers:
      Minimum Required Facebook App configuration:
      on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "http://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows:
      Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post.
      Usage
      edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept.
       
      Download
      PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost   Note: Facebook SDK for PHP is utilized.


    • By flydev
      There you can download the module : https://modules.processwire.com/modules/duplicator/
       
       
      ---
      Introduction
      I was not aware of this module/topic and spend some time developing a module to backup, clone and move sites to a local folder or even GoogleDrive and Dropbox.
      The idea begun when I read about this Wordpress's plugin. I was planning to add features like s/FTP, Amazon Cloud, deployment installer and others great features from Wordpress Duplicator and release it for free to the community.
      Now that I see this @rot's module , I am wondering if it would be benefit to the community to have a second solution and so, if I should finish it.. ?
      ---
      Features / Wishlist :
      Save package to local folder :  implemented Save package to Amazon AWS : implemented Save package to Dropbox :  implemented Save package to GoogleDrive :  implemented Save package to FTP/FTPS :  implemented Manual backup with a standalone button :  implemented Backup from scheduled cron job :  implemented Exclude by file extension / filename / directory :  implemented File naming convention (Y-m-d_H-i-s-description.ext)   implemented Protect access to the module screen by role/user   implemented Installer / deployment functionality   implemented ---
      2017-02-07: Starting the CLOSED BETA TESTING.
      2017-11-28: Module release - version 0.0.44 at https://github.com/flydev-fr/Duplicator
       
       
      screenshots:


       
    • By kongondo
      FieldtypeRuntimeMarkup and InputfieldRuntimeMarkup
       
      Modules Directory: http://modules.processwire.com/modules/fieldtype-runtime-markup/
      GitHub: https://github.com/kongondo/FieldtypeRuntimeMarkup
      As of 11 May 2019 ProcessWire versions earlier than 3.x are not supported
      This module allows for custom markup to be dynamically (PHP) generated and output within a page's edit screen (in Admin).
       
      The value for the fieldtype is generated at runtime. No data is saved in the database. The accompanying InputfieldRuntimeMarkup is only used to render/display the markup in the page edit screen.
       
      The field's value is accessible from the ProcessWire API in the frontend like any other field, i.e. it has access to $page and $pages.
       
      The module was commissioned/sponsored by @Valan. Although there's certainly other ways to achieve what this module does, it offers a dynamic and flexible alternative to generating your own markup in a page's edit screen whilst also allowing access to that markup in the frontend. Thanks Valan!
       
      Warning/Consideration
      Although access to ProcessWire's Fields' admin pages is only available to Superusers, this Fieldtype will evaluate and run the custom PHP Code entered and saved in the field's settings (Details tab). Utmost care should therefore be taken in making sure your code does not perform any CRUD operations!! (unless of course that's intentional) The value for this fieldtype is generated at runtime and thus no data is stored in the database. This means that you cannot directly query a RuntimeMarkup field from $pages->find(). Usage and API
       
      Backend
      Enter your custom PHP snippet in the Details tab of your field (it is RECOMMENDED though that you use wireRenderFile() instead. See example below). Your code can be as simple or as complicated as you want as long as in the end you return a value that is not an array or an object or anything other than a string/integer.
       
      FieldtypeRuntimeMarkup has access to $page (the current page being edited/viewed) and $pages. 
       
      A very simple example.
      return 'Hello'; Simple example.
      return $page->title; Simple example with markup.
      return '<h2>' . $page->title . '</h2>'; Another simple example with markup.
      $out = '<h1>hello '; $out .= $page->title; $out .= '</h1>'; return $out; A more advanced example.
      $p = $pages->get('/about-us/')->child('sort=random'); return '<p>' . $p->title . '</p>'; An even more complex example.
      $str =''; if($page->name == 'about-us') { $p = $page->children->last(); $str = "<h2><a href='{$p->url}'>{$p->title}</a></h2>"; } else { $str = "<h2><a href='{$page->url}'>{$page->title}</a></h2>"; } return $str; Rather than type your code directly in the Details tab of the field, it is highly recommended that you placed all your code in an external file and call that file using the core wireRenderFile() method. Taking this approach means you will be able to edit your code in your favourite text editor. It also means you will be able to type more text without having to scroll. Editing the file is also easier than editing the field. To use this approach, simply do:
      return wireRenderFile('name-of-file');// file will be in /site/templates/ If using ProcessWire 3.x, you will need to use namespace as follows:
      return ProcessWire\wireRenderFile('name-of-file'); How to access the value of RuntimeMarkup in the frontend (our field is called 'runtime_markup')
       
      Access the field on the current page (just like any other field)
      echo $page->runtime_markup; Access the field on another page
      echo $pages->get('/about-us/')->runtime_markup; Screenshots
       
      Backend
       

       

       
      Frontend
       

×
×
  • Create New...