Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The current export button uses an image with a hardcoded image path:
<a href="....">
<img src="/sites/all/modules/views_data_export/images/csv.png"
alt="Download CSV File"
title="Download CSV File" height="14" width="36">
</a>
That is hard for a themer to overwrite; you'd have to use jQuery to manipulate the dom directly.
It would be great if this was stylable instead with CSS. Instead of the imgage tag, you could use some inner divs and then set the background image using CSS.
Comment | File | Size | Author |
---|---|---|---|
#31 | views_data_export-styleable_export_links-1379672.patch | 8.66 KB | legato |
Issue fork views_data_export-1379672
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 1379672-export-button-make changes, plain diff MR !9
Comments
Comment #1
johnv+1 ,
an alternative is to generate a link, like the following modules do:
- print: 'print this page', 'send this page'
- nodereference_url: 'create node'
They support a link with only title, or include an icon, too.
Comment #2
nagy.balint CreditAttribution: nagy.balint commentedI've made this patch to solve this issue for version 7.x-3.x-dev.
After you apply this patch the export links will only contain the Attach text, not an image, and the new css file will provide the proper background and will hide the Attach text from the link. Also i added a shared option which lets you select whether to have the image or just simple text link (basically the link gets a different class).
Comment #3
nagy.balint CreditAttribution: nagy.balint commentedchanged status.
Comment #4
johnvHi Bálint, I tested your patch, I like it, and I have the following comments:
- there is no need to put the css-file in a separate directory.
- the new setting is now under the FORMAT section. IMO this sets the file settings; it would be better to put it under DATA EXPORT SETTINGS, in the list "Path:, Attach to:, Batched export:"
- the default layout is now out-of-style. It would be nice if one could choose for one of both standard options:
-- action-link (like admin/content/node )
-- inline-link (like print moduleprint module )
See attached printscreen.
Comment #5
nagy.balint CreditAttribution: nagy.balint commentedSorry for the time it took me to get back to this.
I updated my patch to the latest dev, and reworked it according to your feedback, except your last point.
Im not sure how i could change the html structure of the feed_icon part of the template around the links, without overwriting the whole views-view.tpl template which is in the views module.
I attached the updated patch.
Comment #6
emorency CreditAttribution: emorency commentedWe export our views with Features. When I export the vies after applying the patch #5, I don't have the attribute 'link_only' so I have an error when reimporting my views... Would it be possible to have a default behavior to show only icons if the attribute is not found ?
In plugins/views_data_export_plugin_style_export.inc, change the line to this:
Comment #8
abhi.sharma CreditAttribution: abhi.sharma commented5: styleable_export_links-1379672-5.patch queued for re-testing.
Comment #11
brandy.brown CreditAttribution: brandy.brown commentedI don't understand why there is a hard-coded image associated by default anyway ... ??? If a person wants an image, they can css a background image.
Comment #12
pancho29 CreditAttribution: pancho29 commentedI've rerolled the patch for 7.x-3.0-beta8.
Comment #13
lolandese CreditAttribution: lolandese commentedI get some errors when trying to apply the #12 patch. Can you have a look what I am doing wrong? See attachment for my terminal output.
Thanks.
Comment #14
darvanenI'm not familiar enough with git patching to help you but it did work for me using 'patch -p1 < filename' against the 7.x-3.x branch.
No errors with the patch that I can see.
Comment #16
rooby CreditAttribution: rooby commentedHere is the exact patch from #12 rerolled to apply cleanly to latest dev version.
Also I'm guessing this is no longer assigned to nagy.balint since that was 3 years ago, so unassigning.
Comment #17
rooby CreditAttribution: rooby commentedPatch works fine for me.
I had a quick look over the code and there are no obvious coding standards issues but I haven't reviewed it technically.
Comment #18
Sborsody CreditAttribution: Sborsody commentedThe only issue I ran into after applying this patch was an undefined index error when looking at the view. Basically the "link only" setting isn't set until after explicitly setting it and re-saving the view.
Comment #19
Sneakyvv CreditAttribution: Sneakyvv commentedWhen you attach two (or more) views_data_export displays to one page display, it's impossible to make a distinction between them (except by the title attribute on the XLS-icon). So, I've expanded the patch from #16 to make it possible to add extra CSS classes to the link which allows to distinct the links or simply allows to add styling to them.
I also fixed the issue Sborsody described.
Comment #20
PhilYHello,
In release 7.x-3.0-beta8, the feed icon link is fully themable as indicated in theme/views_data_export.theme.inc file (lines 22 to 50).
For example, to change all XLS export icon:
in which
$image_path
and$image_class
variables were added and$image
variable is altered to use added variables.Comment #21
andileco CreditAttribution: andileco as a volunteer commentedThe last patch in the related issue that I added does the same thing as this patch, but approaches it in another way...perhaps a simpler way? Please check it out.
Comment #22
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedI prefer this patch and approach to the one in: #2261167: Option for non-image link display, I wonder if we couldn't just reduce it down to sending some classes to the theme function though, singling out a specific option for making the link use the 'default icon' or something, which just adds a class to the set of classes to add.
Happy to work on this in bit, unless someone else wants to pick it up.
Comment #23
andileco CreditAttribution: andileco as a volunteer commentedHey @Steven Jones--one of the things I liked about the other patch is that the alt text (which became the text displayed within the button/link) and the class options were both in the same location, so a site builder would only need to go to one place to do everything related to this. If you work on this patch, could you try to incorporate that same idea? Last time I tried this patch, it seemed less user-friendly in that way, so I continued to work on the other patch.
Comment #24
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedComment #25
Vali Hutchison CreditAttribution: Vali Hutchison commentedAny update on this one - seems to have ground to a halt, likewise for #2261167: Option for non-image link display
Comment #26
capysara CreditAttribution: capysara commentedPatch #19 works for me.
Comment #27
Rafal LukawieckiPatch #19 works for me. It would be nice to have it committed.
Comment #31
legato CreditAttribution: legato commentedCSS classes must be added as array elements, not as a concatenated string.
Comment #32
anoopsingh92Hi,
I am assigning this issue to me. Let me try once to fix that. I will update you soon as I can fix it or not.
Thanks
Comment #33
anoopsingh92Comment #34
anoopsingh92Hello @legato, I tried to apply both files of your patch but both are not applying to me.
Getting this error.
Can you please suggest how to fix that issue?
Thanks
Comment #35
anoopsingh92Need work