I figured I should start a new thread since the last d7 patch has been committed and the 7.x-dev version is out. This extends the module further making sure to cleanup after itself when a node is deleted, and if a node type has a default panel configured the settings page for a node will allow a user to reset the panel display to the default display for that node type
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | panelizer-n1175556-19-d6.patch | 499 bytes | neclimdul |
| #15 | panelizer-n1175556-15b-d6.patch | 1.39 KB | damienmckenna |
| #15 | panelizer-n1175556-15b-d7.patch | 1.39 KB | damienmckenna |
| #9 | panelizer-panelize-bug-fix.txt | 919 bytes | cangeceiro |
| #8 | 1175556-8.reset-vs-panelize-it.patch | 1.04 KB | dww |
Comments
Comment #1
dwwThanks for working on this. However, it's not immediately obvious what these two things have to do with each other. Why are they in the same issue and patch? That just makes it harder to understand what's changing and why.
Furthermore, ever since D6, the suggested way to have different buttons with different results is to register separate submit handlers for each button. Inspecting
$form_state['clicked_button']['#value']isn't The Right Way(tm) to do this.Comment #2
cangeceiro commentedThe delete hook was added to make reseting the panel display possible. basically resetting just removes the display and the reference to the display in the database so that it falls back on rendering using a default. So that is why they are both wrapped into this patch. I havent seen any examples of using separate submit handlers but I am open to reworking this to The Right Way™.
Comment #3
dwwThanks for the explanation about how delete and reset are intimately tied, that helps!
Re: separate submit handlers for different buttons. Check out node_form() (in either D6 or D7 -- I linked to D6 but the same works in D7). Let me know if that's clear enough, or if you need further direction.
Cheers,
-Derek
Comment #4
cangeceiro commentedAh yes, that helps greatly. here is an updated patch using #submit for the reset
Comment #5
dwwLooks great. Any chance you can provide a D6 backport (e.g. without the DBTNG notation)? Thanks!
Comment #6
dwwI had to re-roll this a bit due to some other fixes I pushed to the 7.x-1.x branch, although I mostly got that working with a bit of Git treachery -- there was only 1 hunk that conflicted. However, this visually looked fine, and I don't have a D7 test site yet (and apparently no one else did, either -- see #1100922-28: Drupal 7 port of Panelizer), so I just went ahead and committed and pushed my re-roll:
http://drupal.org/commitlog/commit/18014/54475a0f80973c633b223096612e3c6...
However, unfortunately, this didn't apply at all to the end of the 6.x-1.x branch, even with various tricks (maybe my Git fu isn't strong enough yet, but I think it's due to divergences from the D7 port). :( So, I manually backported the fixes, including undoing the DBTNG query, using hook_nodeapi() instead of hook_node_delete() (which doesn't exist in D6), etc. The D6 version I could actually test, and I uncovered a few bugs. When you tried to delete a node, you got an undefined call to panelizer_load_node_panelizer() since includes/node.inc wasn't loaded. Also, the drupal_set_message() when you reset the panel was missing a trailing period. But with all that fixed and working, I committed and pushed it to 6.x:
http://drupal.org/commitlog/commit/18014/a285cbee85f413b40c515a1a174b460...
Then I forward ported my bug fixes to 7.x:
http://drupal.org/commitlog/commit/18014/518ed126a4ca5cd9d2e3b7adf989ff0...
So, unless the D7 version is totally broken (entirely possible), let's call this fixed.
@cangeceiro: Thanks! This is a good change...
Comment #7
dwwWhoops. Earl had to revert part of this patch:
http://drupal.org/commitlog/commit/18014/fb0500c91b00b6c013237481fca57ae...
That probably means that the "Panelize it!" button doesn't work in the 6.x-1.x branch right now, either.
Comment #8
dwwYeah, the attached patch gets the "Panelize it!" button working again, but then things get a bit wonky when you try to do the reset case. :( I need to break for dinner, so I don't have time to clean this up, but it'd be great if cangeceiro could take another stab at this issue to make sure it works properly and doesn't break anything else. Thanks.
Comment #9
cangeceiro commentedThis patch fixes the "panelize it" button on d7. This also gives the reset button for a panel that has been panelized with or without a default panel configuration.
Comment #10
cangeceiro commentedstatus change
Comment #11
merlinofchaos commentedOk, I have to revert this patch *again*.
Let me explain. There was some pretty serious ignoring of how I'd set this up.
Panelizer is intended to be able to panelize anything. Right now it only panelizes nodes, and I think that's leading to the confusion.
Stuff in common.inc is common functionality. These forms are re-used in a LOT of places. The reasons they were written the way they are is so that they can be reused.
This patch rather unfortunately removed the reusability by hardcoding submit logic directly into the form, and worse, it actually hardcoded $node into a form in common.inc. Unfortunately, at the time dww was asking me questions about this, I was trying to pay attention but I was busy, and I didn't go refresh myself on the architecture.
I have to roll back this feature and return the form to its pristine "I don't know a thing about nodes" state.
I've added a comment to the doxygen about the form
That form is used both when editing a panelized node, and when editing a default panelized node. It can't make assumptions. In the future, that form will be used when editing a panelized user, and the default for a panelized user as well.
Comment #12
merlinofchaos commentedI re-implemented the reset button. I tested it on D6 and cherry-picked it to D7. I also committed cangeceiro's fix for the panelize it form. I think that completes the issue.
I admit to not testing either on D7.
Comment #13
damienmckennaThe reset button shows, but the panelizer_settings_form_reset() callback function doesn't exist in either the D6 or D7 branches.
Comment #14
damienmckennaIf panelizer_settings_form() is supposed to be generic, wouldn't it be better for it to *not* define a menu callback but maybe accept that from the calling function, e.g.:
and then:
Comment #15
damienmckennaHere's a quick patch to add a reset button for the content type settings page, one patch for each of D6 and D7.
Comment #16
merlinofchaos commentedCommitted to both branches.
Note that ot get the button to show up I had to add $form_state['reset button'] => TRUE
Comment #18
pverrier commentedI'm using the Drupal 6 version (6.x-1.0-beta1), and have been wondering why I had no way to revert a local node Panelizer settings to the defaults...
This has been solved in #16 (september 2011) and commited in dev, but the last release for D6 remains older (2011-Feb-26).
Please could you release a beta 2 version with these latest devs? Thanks!
Comment #19
neclimdulWoops, db_delete doesn't exist in d6.
Comment #20
neclimdulpushed. back to fixed.