I have made a repack with a few tweaks.
Base code is almost the same, just the paths are not tied to /couch/addons/ folder and became relevant.
Additional tweaks are in separate files and include: alert on a clone, frontend link, reverse_relation fix by KK and a more detailed README which includes the example with
cms:db_persist tag discussed in later posts (as repo links are no longer valid).
- copy-to-new-alert.png (5.6 KiB) Viewed 28444 times
Repack was necessary to fit the addon into my new way of loading addons and other scripts outlined in topic
viewtopic.php?f=2&t=13473 So the Installation mostly is the same, I'll quote from README, with only difference to regular method is using a new connector file (which is actually a good way for any other addon that might be extended without adding a separate line in kfunctions
) :
## Installation
Move addon to `/addons-enabled/` folder (if using autoloader) or follow the regular method -
1. Extract the folder named 'copy-to-new' from the attached zip and place it in 'couch/addons' folder.
2. Activate the addon by adding the following entry in 'couch/addons/kfunctions.php' file (if this file is not present, rename 'kfunctions.example.php' to 'kfunctions.php') -
```php
require_once( K_COUCH_DIR.'addons/copy-to-new/__autoload.php' );
```
And that
__autoload.php file is a very basic connector in the zip which you can edit to remove some tweaks if not interested in them:
- Code: Select all
<?php
if ( !defined('K_COUCH_DIR') ) die(); // cannot be loaded directly
// base addon
require_once( __DIR__ . '/copy-to-new.php' );
// addition by KK to copy reverse relation fields
require_once( __DIR__ . '/copy-reverse-relation.php' );
// alert to save on a new clone
require_once( __DIR__ . '/copy-to-new-alert.php' );
// variable with a link to clone from the frontend
require_once( __DIR__ . '/k__clonepage_link.php' );
P.S. A new thing, better than it was in repo, is that the alert is integrated with addon with PHP code, so no need to copy paste a snippet to template's config_form_view tag to activate alert. Just install addon and it's enabled.