I love this module!

However, I created a layout type and manually applied it to 26 different nodes of the same content type. Later, I decided to add something to it. Now I have to go back to all 26 nodes and reapply it to each one in order to see the added content type.

A nice feature would be for it to automatically reapply the layout type to existing nodes that already use that layout type.

Comments

bengtan’s picture

Feature request noted ... Unfortunately, I'm not sure when I'll have the spare capacity to implement it. Sorry.

ericinwisconsin’s picture

I understand. I appreciate your module and that you noted the feature. Thanks!

simmoe’s picture

Subscribe - I think this feature is really important :) Doing a bulk update of a lay-out set for existing nodes is really rather necessary on a large site- right now i'm begging my designer wont ask me to change the order of fields in our most common nodetypes- it'll take me a half day to change the nodes manually.

Would economic support do any help - in that case how and how much?

Love this module!

Simon

bengtan’s picture

(@3: Thanks for the offer. It's only because of the commercial prospects that I am giving some thought to this at the moment. I will contact you privately when it's time to talk about commercial matters. However, that's too early at the moment, because I need to work out the required behaviour first.)

Hmmm ... this is actually not immediately straightforward - I have to think of a way to do things safely without accidentally deleting user data (which would be really bad).

So, let's discuss some requirements.

I think 'applying a layout set' in this set shouldn't replace the existing layout set of existing nodes. It would have to only add fields. Blindly replacing the entire layout could very well result in overwriting user data.

Would that be satisfactory for both your respective situations?

Else, I'd have to add in some extra data to remember which nodes have their layout manually configured, and only update nodes which have a layout which has not been altered since being assigned - which is messy, troublesome and I'd rather not have to do.

Any thoughts?

ericinwisconsin’s picture

Just adding new data would be acceptable for my personal situation, but what if a situation is the opposite, and some data has to be removed?

I understand the way you have things set up. The chosen layout set is essentially applied at the time of node creation, then the node is assigned to the composite layout template the layout set is based on.

For example, I have a website about old magazines that includes nodes with data about the magazine and a picture of the cover. I created a layout set called "Issue Layout Set" that is applied to that node type at the time of creation. The "Issue Layout Set" is based on the "Two Columns" composite layout. Rather than create a new .tpl file every time a layout set is created, the newly-created node is assigned to its corresponding composite layout.

Therefore, when one changes the layout set, it doesn't change every node created with that layout set. Changing the node's layout isn't as easy as just clicking the edit tab and saving it. The changed layout set has to be reapplied to each node by someone with the permissions to change the composite layout by choosing the original layout set.

This is kind of long-winded, I guess, but I'm trying to make things clear in my own mind.

How about this for a fix: When a layout set is created, a new .tpl file is created in modules/composite/theme that corresponds to the new layout set. The node that's created is assigned to this new layout set .tpl file so that if the .tpl file is changed, all nodes made with it are also changed?

Does this sound doable or am I babbling?

simmoe’s picture

StatusFileSize
new6 KB

Ah ok Bengtan, after reading your reply and thinking a while I now understand your concern (my brain is very slow : )). Of course, the choice to update all nodes of a certain type with an existing lay-out set, should somehow be optional. So basically what i need is more of a "reset" function - see the attached pic.

This sollution could then over time be expanded with an advanced option to only change nodes that have not been customized.

What do you think?

Best,
Simon

bengtan’s picture

@6: The 'reset' button as you've described it, is quite elegant and intuitive, so it'll be straightforward to implement.

@5: Pushing aside the implementation details for the minute and just thinking about the design, I think what you're trying to describe is some way of flagging some nodes so that they can get automatically updated.

(Whether this is done via a separate .tpl.php file, or via some new node variables, is a decision that can be postponed for this discussion)

Those which haven't had their layout modified from the layout set can be optionally updated when the site administrator decides 'Oh, I want to update this layout set for all applicable nodes'. Does this agree with what you had in mind?

bengtan’s picture

Thinking some more ... If we expand the solution ...

One could add two extra variables to each composite enabled node:

A. A variable indicating which layout set it was initialised from (if any)
B. Another variable/flag indicating whether the node's composite layout should be updated if the site administrator decides to bulk-update nodes with the layout set from (A).

The user can set or clear variable (B) as desired.

This approach would give the user flexibility to bulk-update layout sets if they wish to use it.

Problem now is ... it's quite a significant chunk of work. And I have a sneaking suspicion I'm going to have to create a new admin page or two because the layout sets functionality is outgrowing the current user interface of Composite Layout.

So, I'm not sure how simmoe feels about sponsoring something like this. I don't think I'd have the time to do this otherwise.

Comments welcome.

simmoe’s picture

It all depends : )

My organisation is willing to pay the cost of the functionality i described @6. If you can set a reasonable price and scope for that task, we can begin today. Regarding the full implemenetation of your idea @8 I can understand if you feel the functionality @6 is only worth a patch - that'll do!

-unless ericinwisconsin wants to chip in of course?

ericinwisconsin’s picture

Your comments @7 are acceptable, bengtan. A simple reset switch works for me.

Well, "simple" to me, since I don't have a clue how to code it. :)

Thanks for your work on all this, bengtan.

bengtan’s picture

Okay, so it seems like simmoe would be happy to sponsor the 'reset' button from comment #6, and ericinwisconsin is satisfied with that as well.

Simmoe: I sent you a private email yesterday through your Drupal contact form at http://drupal.org/user/253709/contact. Do you want to have a look at that in your inbox?

bengtan’s picture

Version: 6.x-1.0-beta7 » 6.x-1.0-beta8
Status: Active » Needs review
StatusFileSize
new30.39 KB

Hi,

I've just committed this functionality into cvs (http://drupal.org/cvs?commit=275054).

I don't like doing dev snapshots, so instead, please download the attached 'dev' release and give it a try.

This only does the 'reset' functionality of #6.

Also, if you have many many nodes (ie. maybe 1000), and you do this reset, you may need a very large PHP memory_limit.

Thank you.

simmoe’s picture

This looks good - thank you very much.

Best,
Simon

ericinwisconsin’s picture

Thanks, Bengtan!

It did about 1/2 of the content type for me, but since I put in this feature request, my pages have increased to 640! That's a lot to ask of it and php, and my situation is unique, so I'm happy. Thank you.

bengtan’s picture

Status: Needs review » Fixed

I believe this feature request is complete. It will be incorporated into the next release of Composite Layout, whenever that will be. In the meantime, please continue to use the snapshot from comment 12.

Thank you.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jeffam’s picture

Looks like this patch was removed from a subsequent dev release. Out of curiosity: was the functionality not working correctly?

Regards,
Jeff

bengtan’s picture

Hi,

No, I don't think it's been taken out. Possibly the checkbox on .../admin/content/node-type/nnn only appears if there are layout sets defined.

jeffam’s picture

Weird. I couldn't find the code for the checkbox in the dev version I downloaded, and a scan of what appears to me to be the most recent CVS commit of the module seems to show the code being removed: http://drupalcode.org/viewvc/drupal/contributions/modules/composite/comp...

Maybe it was removed accidentally? Or am I looking at that CSV browser incorrectly?

Jeff

bengtan’s picture

Status: Closed (fixed) » Fixed

Oops, sorry. My mistake. I botched a patch from a previous issue and accidentally took out this and some other stuff. It's been fixed now. Please update from cvs.

References:
http://drupal.org/cvs?commit=408468
http://drupal.org/cvs?commit=408466

jeffam’s picture

Status: Fixed » Closed (fixed)

Thanks for fixing this, and for the new dev release, too!