Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When I attach the Data Export in Views, The icon displays in the buttom of the page, how can I put that feed XLS icon on top and/or design it ?
Comments
Comment #1
PhilYThat would be great to be able to choose to put the icon either on top or bottom of the attached display...
So far, as I'm using jsInjector module on my website, I'm using a small jQuery code to move the icon above the view :
in which "xxxxxxxxxxxxx" should be replaced by the view machine name.
Comment #2
magnetive CreditAttribution: magnetive commentedYou can override the Views Theme. Then you can put the Icon ("feed-icon") on top.
Comment #3
PhilYThanks, would you mind providing an example?
I'm a beginner in theme template overriding ;-)
Comment #4
5t4rdu5t CreditAttribution: 5t4rdu5t commentedIf you want to display the icon on both top and bottom of your "Page" display you can easily do it by adding a Global: PHP field to your view's header with the following code:
print $view->feed_icon;
Make sure your "Data export" display is attached to your "Page" display.
Comment #5
zarabatana CreditAttribution: zarabatana commentedSolution in #1 worked for me.
Thanks.
Comment #6
pjbarry21 CreditAttribution: pjbarry21 commented#1 also worked for me. Thanks!
Comment #7
rooby CreditAttribution: rooby commentedThe solution in #1 is not ideal because it is unnecessary javascript (and if you aren't already using that module for something else an unnecessary module) and it won't work for users without javascript.
I would also consider your selector 'div.feed-icon' to be too generic and is at risk of acting on markup you don't intend.
The solution in #4 is not ideal because entering PHP into the database like that is not a good idea. For more information on why see this informative stack exchange post.
Having the PHP module enabled at all is also somewhat of a security risk.
The best solution is #2, although that comment doesn't give information on how to do that.
So how you would do that is override the template for the view. This blog post has some more information on overriding views templates (I am in no way affiliated with that website).
So basically this:
Comment #9
gabrielZ CreditAttribution: gabrielZ commentedSolution #7 Worked for me. Thank you.
Comment #10
markusd1984 CreditAttribution: markusd1984 commentedbrilliant thanks for sharing, would be great to theme a button with text, ideally with hover effect instead of a static image.