Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Jan 2012 at 19:34 UTC
Updated:
25 May 2021 at 15:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dawehnerI would really like to have this feature but it has to be clear for the user that the options which are special for this display (which are not that easy to detect) might be removed.
Comment #2
lukusI agree this is a great idea. Perhaps a nice way of implementing this would be to offer a 'Clone as...' option, so the user's provided with a duplicate in the new display style which they can preview before saving.
Comment #3
tim.plunkettThis is a really rough first pass, just to demonstrate the idea.
I just duplicated the relevant code needed, ideally it could just be abstracted to work for both.
Comment #4
tim.plunketthttps://skitch.com/plnktt/8nu4t/fullcalendar-content-d7
Comment #5
tim.plunkettChatted with @dereine about this, here's another idea. Much less code. Still doesn't fully work.
https://skitch.com/plnktt/8nwd9/fullcalendar-content-d7
Comment #6
tim.plunkettTriggering the testbot.
Comment #7
korzh-nick commentedThanks for the patch. I patched the version 7.x-3.3 - I cloned the page as a block. Clone title and filter settings are not working. More precisely cloned default.
Comment #8
tim.plunkettYeah, this definitely doesn't work yet.
Comment #9
dawehnerLet's implement that for Drupal 8.
Comment #10
dawehnerGot it working for overridden values as well.
Comment #11
damiankloip commentedNice, that's the main issue I found. I'll test this in the morning!
Comment #12
damiankloip commentedWe should probably unset (maybe?) or set the display_title to something too? As at the moment, wont this just inherit whatever the display being cloned from has? So if you cloned 'Page 7' your clone display title would also be 'Page 7'.
Comment #13
dawehnerYeah you are right, what about something like that?
Comment #15
dawehnerRewrote that cloning part to better work as expected and added a test.
Comment #16
damiankloip commentedThat's a much cleaner way to merge the options, I was going to suggest something along those lines :) Like that.
This patch is looking good now. It is working as expected with the overridden options, as well as the quibble with the title.
I wont RTBC just yet, we should get a couple more people to test first.
Comment #18
damiankloip commentedThe tests were assertingEqual for the title, but asserting on the display plugin object and not the display_title, also the change in #15 for the merging (+=) doesn't do a deep merge, so I've added NestedArray::mergeDeep instead, we can use this (which I'm ok with) or switch back to the previous method of doing this.
Also, probably out of scope for here, but I think the regular submitDisplayDuplicate method doesn't handle the title properly, if you have a page and you clone the title will still be 'Page'.
Comment #19
damiankloip commentedOops! a real patch would be good. Thanks tim.
Comment #20
dawehnerThis change looks fine, so do you agree this is RTBC?
Comment #21
damiankloip commentedI am happy with this now, but I did the last fix. So maybe Tim should do the honours?!
Comment #22
tim.plunkettI'd like to review this but it's Christmas so if you don't mind waiting until Wednesday...
Comment #23
tim.plunkettThis still doesn't actually work. Taking a page display and cloning as a block indeed adds a display called block_1, but it's still actually a page display plugin.
I've added some failing assertions, I didn't try to debug why.
Comment #24
dawehneruggggggh thanks for opening these eyes ... I swear this worked in the first versions of the patch!
Comment #25
tim.plunkettAh, that was a good fix.
It works now, and passes tests.
Comment #26
catch#24: drupal-1401778-24.patch queued for re-testing.
Comment #28
damiankloip commentedWe need to get() that stuff instead.
Comment #30
damiankloip commented#28: 1401778-28.patch queued for re-testing.
Comment #31
dawehnerThanks for bringing this back to the table!
Back to RTBC once it's green.
Comment #32
tim.plunkettRerolled for #1757564: Change 'name' to 'id' on View entity
Comment #33
catchLooks good. Committed/pushed to 8.x
Comment #34
rogical commentedIs that possible to backport to D7?
Comment #35
dawehnerComment #36
FranCarstens commentedWas this ever ported?
Comment #37
zalak.addweb commentedComment #38
3dnathaniel commentedsubscribing for d7 port
Comment #39
alex.bukach commentedComment #41
alex.bukach commentedComment #42
weka commentedBrilliant, thanks Alex.
Patch in #41 seems to be working fine with latest 7.x-3.20+0-dev.
Comment #43
davidkp commentedBrilliant #41 works perfect! Thanks
Comment #44
alfthecat commentedThis patch is the time-saver of the year! Works brilliantly against the latest dev, views just got even better. Thanks everyone!
Comment #45
damienmckennaNice work everyone.
Has anyone tested to see if there are problems cloning a display and carrying along settings which are not appropriate for the new display type? For example, if you clone a page and make it a block, do errors show up related to the original page display's options? Are the old settings exported with the new display?
Comment #46
alfthecat commentedFor my part, I've been cloning at least a dozen blocks to panels content panes and not a single error. Neither did settings get lost that are shared between source and clone (such as table style config like sorting options, css row classes, etc). I've also cloned a page to a views data export display and no problems at all.
Also aplied the patch against latest stable version, and everything works fine too.
This is indeed really great work, and to much delight.
Comment #47
philyPatch #41 works for me tested using Drupal 7.70 with patch applied to Views 7.x-3.24
Cloning a page (with menu parameters) to a block triggered no errors so far, all settings where cloned perfectly (except unrelevant like menu) and both page and block run OK.
Thanks to all for your efforts.
Comment #48
nwom commented#41 worked great. Setting as RTBC, since others have said it works perfectly as well. Thanks for everyone's work on this!
Comment #49
jasonaaronwood commentedApplying the patch from #41 gives me the error:
Comment #50
damienmckennaCommitted. Thank you all!
Comment #52
damienmckenna