vknt Posted October 9, 2011 Share Posted October 9, 2011 Hi all, When making a new template you can tell it to duplicate fields from another template. Can we do the same for fields? I spend alot of time configuring fields that are just a 1 setting different than another one I already have e.g. I love the description on fields. It really helps if I can type something in there to tell what the field does. But e.g. images on 1 page is doing something else on another page. That makes i have to create 2 with only a different description. That is why a duplicate would be useful for me among other things.. Link to comment Share on other sites More sharing options...
ryan Posted October 10, 2011 Share Posted October 10, 2011 It's a good idea and I've had the same need–will plan to add this (likely in 2.2). [edit: fixed my typing, I'm terrible at trying to reply using the iphone] Link to comment Share on other sites More sharing options...
Soma Posted October 10, 2011 Share Posted October 10, 2011 +1 ;D Link to comment Share on other sites More sharing options...
ryan Posted December 7, 2011 Share Posted December 7, 2011 This has been added in the latest commit of the 'dev' branch (for 2.2). You'll see the Field duplicate/clone option under the 'advanced' menu when editing a field. From there, you just check the box asking you if you want to clone the field and click save. You can also access it from the API like this: <?php $field = $fields->get('title'); $clone = $fields->clone($field); The new field that is returned ($clone) has already been saved, so you don't need to save it again. Also note that it automatically assigns a new name to the field to ensure it's unique. Like with cloned pages, it adds an incrementing number to the end of the name: <?php $clone = $fields->clone($field); echo $field->name; // would print 'title'; echo $clone->name; // would print 'title_1'; You can of course go back and rename it to whatever you want. <?php $clone->name = 'something_else'; $clone->save(); Template duplicate/clone An identical clone() function was also added to the template editor. You'll see it in the 'advanced' menu when editing any Template. When you clone a template, the Fieldgroup is cloned and the template-file is also cloned if /site/templates/ is writable. Using it in the API is exactly the same as with cloning a field, and the behavior is exactly the same: <?php $template = $templates->get('basic-page'); $clone = $templates->clone($template); 1 Link to comment Share on other sites More sharing options...
diogo Posted December 7, 2011 Share Posted December 7, 2011 great Link to comment Share on other sites More sharing options...
vknt Posted December 7, 2011 Author Share Posted December 7, 2011 Great stuff! Link to comment Share on other sites More sharing options...
panx Posted June 24, 2015 Share Posted June 24, 2015 This has been added in the latest commit of the 'dev' branch (for 2.2). You'll see the Field duplicate/clone option under the 'advanced' menu when editing a field. From there, you just check the box asking you if you want to clone the field and click save. At my current PW version 2.6.3 the duplicate/clone option moved to the 'action' menu. Link to comment Share on other sites More sharing options...
Nico Knoll Posted June 27, 2015 Share Posted June 27, 2015 @panx I think this is intended Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now