Download & Extend

Add field values for easier navigation

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.

AttachmentSize
composite.patch6.45 KB

Comments

#1

Assigned to:Anonymous» bengtan

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_element as a temporary fix.

#4

Status:needs review» needs work

#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 reference
  else if (isset($element['fid'])) {
    return l($element['filename'], $element['filepath']);
  }

#7

Status:needs work» fixed

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

Status:fixed» needs review

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 fields
  foreach ($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

Version:6.x-1.0-beta5» 6.x-1.0-beta6
Status:needs review» fixed

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

Status:fixed» closed (fixed)

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

nobody click here