Posted by agentrickard on December 22, 2008 at 8:40pm
Jump to:
| Project: | Composite Layout |
| Version: | 6.x-1.0-beta6 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | bengtan |
| Status: | closed (fixed) |
Issue Summary
This module is a good alternative to panels-based nodes, and really helped on a project.
I find it to be much easier to use if you can get a small preview of the field contents when selecting and sorting the elements into zones.
The attached patch modifies _composite_references_preprocess to pass the $node object so that field previews can be rendered.
It also removes the empty parent field in instances where multi-value fields are used.
| Attachment | Size |
|---|---|
| composite.patch | 6.45 KB |
Comments
#1
Hi,
Thanks for this patch. You're right, it does make things easier.
However, I'm considering making a minor change or two to the patch before committing. Among other things, _composite_cck_preview_element() might go into composite.module since it's not really CCK specific.
I will try to spend some time on this in early January. Let me get back to you on it, but if I seem to be taking too long, feel free to bump this issue.
Thank you.
#2
Not a problem.
#3
The patch does not work correctly with Filefield, since the UID handling falsely returns the UID. So this patch needs some more love. I added an FID if check handler to
_composite_cck_preview_elementas a temporary fix.#4
#5
Hi,
I'm looking at this issue now, and merged your patch into my own private repository (which I will later propagate to drupal CVS).
But ... I modified your patch slightly in the process (no functional changes, just some syntax transformations).
Do you want to communicate to me the changes you did for comment #3?
Either a new patch (from your system), or a code description will do. I can do the necessary merging and then commit to drupal CVS.
#6
I just added an 'fid' IF statement between the NID and UID checks in _composite_cck_preview_element().
// File referenceelse if (isset($element['fid'])) {
return l($element['filename'], $element['filepath']);
}
#7
Composite Layout 6.x-1.0beta6 has been released with your proposed functionality. Please use and let me know how things go. Thank you for your input.
#8
Nice. I found one small bug that occurs if we have an empty multivalue field.
Fix is line 85:
// Get a list of individual field values for multi valued fields or single fieldsforeach ($fields as $field => $field_info) {
$item = $node->$field;
if ($field_info['multiple'] && !empty($item)) {
...
Adding the !empty($item) prevents the foreach from running when there are no values.
#9
Hi,
I hope you didn't mind me mangling your patch before committing. Maybe didn't quite conform to Drupal collaboration conventions, but anyway ...
I'll take your word for it that comment #8 is a fix, and will commit to CVS sometime soon.
#10
The change from comment 8 has been committed to CVS and will be incorporated into the next release of Composite Layout, whenever that is. Thank you.
#11
Works for me. You have to be comfortable with the code you commit.
#12
Automatically closed -- issue fixed for 2 weeks with no activity.