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">

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.


johnv’s picture

Version:7.x-3.x-dev» 6.x-2.0-beta5
Status:Needs review» Active

+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.

nagy.balint’s picture

Version:6.x-2.0-beta5» 7.x-3.x-dev
new6.28 KB
PASSED: [[SimpleTest]]: [MySQL] 78 pass(es).
[ View ]

I'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).

nagy.balint’s picture

Status:Active» Needs review

changed status.

johnv’s picture

Version:6.x-2.0-beta5» 7.x-3.x-dev
Status:Active» Needs work
new13.59 KB

Hi 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.

nagy.balint’s picture

Assigned:Unassigned» nagy.balint
Status:Needs work» Needs review
new7.52 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch styleable_export_links-1379672-5.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Sorry 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.

emorency’s picture

We 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/, change the line to this:

   'link_only' => isset($this->display->display_options['link_only']) ? $this->display->display_options['link_only'] : FALSE;

The last submitted patch, styleable_export_links-1379672-5.patch, failed testing.

wiseman7687’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 5: styleable_export_links-1379672-5.patch, failed testing.

The last submitted patch, 5: styleable_export_links-1379672-5.patch, failed testing.

brandy.brown’s picture

Issue summary:View changes

I 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.’s picture

new7.54 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch views_data_export-styleable_export_links-1379672-12.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

I've rerolled the patch for 7.x-3.0-beta8.

lolandese’s picture

new2.81 KB

I 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.


Darvanen’s picture

Status:Needs work» Needs review

I'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.

Status:Needs review» Needs work

The last submitted patch, 12: views_data_export-styleable_export_links-1379672-12.patch, failed testing.

rooby’s picture

Assigned:nagy.balint» Unassigned
Status:Needs work» Needs review
new7.65 KB
PASSED: [[SimpleTest]]: [MySQL] 97 pass(es).
[ View ]

Here 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.

rooby’s picture

Patch 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.

Sborsody’s picture

Status:Needs review» Needs work

The 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.

Notice: Undefined index: link_only in attach_to() (line 176 of /export/www/html/sites/all/modules/contrib/views_data_export/plugins/

Notice: Undefined property: views_display::$handler in execute() (line 1134 of /export/www/html/sites/all/modules/contrib/views/includes/

Sneakyvv’s picture

Status:Needs work» Needs review
new8.65 KB
PASSED: [[SimpleTest]]: [MySQL] 97 pass(es).
[ View ]

When 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.

PhilY’s picture


In release 7.x-3.0-beta8, the feed icon link is fully themable as indicated in theme/ file (lines 22 to 50).

For example, to change all XLS export icon:

function MYTHEME_views_data_export_feed_icon__xls($variables) {
extract($variables, EXTR_SKIP);
$image_path = '/path/to/the/xls/icon.png'; // INDICATE HERE THE PATH TO THE IMAGE FILE
$image_class = 'icon-xls'; // INDICATE HERE THE CSS CLASS(ES) TO PUT ON THE IMAGE
$url_options = array('html' => TRUE);
  if (
$query) {
$url_options['query'] = $query;
$image = theme('image', array('path' => $image_path, 'alt' => $text, 'title' => $text, 'attributes' => array('class' => $image_class))); // FUNCTION ALTERED TO ADD CUSTOM CSS CLASS TO THE IMAGE
return l($image, $url, $url_options);

in which $image_path and $image_class variables were added and $image variable is altered to use added variables.

andile2012’s picture

The 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.