Why has the new version suddenly changed the output from list to table?
This breaks site layouts that has overridden styles.
Is there some settings in the module where it's possible to keep the previous list-based layout?
Why has the new version suddenly changed the output from list to table?
This breaks site layouts that has overridden styles.
Is there some settings in the module where it's possible to keep the previous list-based layout?
Comments
Comment #1
iva2k commentedThe original list-based layout had a hard-coded margin that created space for placing mime icons. When adding thumbnails, this does not work, since thumbnail size can be configured to any width. Therefore the code was changed back to tables, like it was styled by original upload.module. There is no such setting to change it back.
If you want to style the output differently with the latest version, you could explore overriding theme functions. ITweak_Upload itself overrides theme_upload_attachments to generate the list of attachments (see itweak_upload_upload_attachments() function in itweak_upload.module). You can implement yourtheme_upload_attachments function (where yourtheme is the name of the theme you use) that will override the override, and generate any output you want. Of course, CSS should be supplemented to style it properly. If you just want the old list format back, you can copy the itweak_upload_upload_attachments() function from old version, rename it yourtheme_upload_attachments(), and include into your theme file. One more step is to register it properly: find yourtheme_theme() function, and add entry to inside of the return array:
You will need to rebuild theme registry / flush caches.
Comment #2
olax commentedThank you for the answer.
It makes it all a bit clearer.
Comment #4
solona commentedI am using version 6.x-2.4 and have overridden the itweak_upload_upload_attachments() function.
I get this error when trying to change the output as a list:
warning: htmlspecialchars() expects parameter 1 to be string, array given in /htdocs/includes/bootstrap.inc on line 857
Any ideas why?
My code:
and I added... (Zen sub-theme)
Comment #5
solona commentedI figured it out. The itweak_upload_upload_attachments() function that ships with version 6.x-2.4 builds upon the row[] array. The line:
creates an array of arrays. The theme('item_list', $array[], $title, $type, $attributes ) function expects the second parameter to be an array of strings, not an array of arrays.
So, I got rid of the row[] array entirely and built one rows[] array and concatenated all of the data. (Note that I also got rid of the $stats and $filesize parts of the code because in my case, for the time being I don't need them).
I also had to change the data output in the case where $file->preview isn't set - for the icons to show up. The icons use CSS background-position. The original code assigns these classes to the table. When using a list, the classes need to be assigned to something, so I added a div with the appropriate classes (see itweak_upload.css starting at line 245).
Here's the code:
and CSS:
.itu-attachment-list .mime {
background: transparent url('/sites/all/modules/itweak_upload/images/mime-16.png') no-repeat center 0;
padding: 0 7px;
margin: 0;
width: 16px;
min-width: 16px;
height: 22px;
min-height: 22px;
}
Comment #6
iva2k commented@solona, You commented on a closed issue, so nobody noticed your question.
Without diving into the code, I think you may have other problems (like javascript not working) since markup is changed. It is definitely not in a committable shape, but thanks for sharing. One more thought - instead of changing all code of the function around $row[] =..., you may just change $rows[] = $row; to $rows[] = join(' ', $row); or something similar.
Comment #7
solona commentedI hadn't considered that, thanks for the idea. Am I allowed to change the status of a closed issue?
Comment #8
iva2k commented>Am I allowed to change the status of a closed issue?
In your case you had 2 options:
1) Re-open - change status to something appropriate. If it is a code not a patch, I'd set it just to "active"
2) Open a new issue
See how I am answering in the closed issue - it just happens that I review all issues once in a while. Many maintainers don't bother for a good reason.
Comment #9
solona commentedthanks for the tip