diff --git a/css/views_data_export.css b/css/views_data_export.css new file mode 100644 index 0000000..0de5a6d --- /dev/null +++ b/css/views_data_export.css @@ -0,0 +1,32 @@ +.views-data-export-doc-attach, +.views-data-export-csv-attach, +.views-data-export-txt-attach, +.views-data-export-xls-attach, +.views-data-export-xml-attach { + width: 36px; + height: 14px; + text-indent: -1000px; + background-repeat: no-repeat; + display: inline-block; + outline: none; +} + +.views-data-export-doc-attach { + background-image: url(../images/doc.png); +} + +.views-data-export-csv-attach { + background-image: url(../images/csv.png); +} + +.views-data-export-txt-attach { + background-image: url(../images/txt.png); +} + +.views-data-export-xls-attach { + background-image: url(../images/xls.png); +} + +.views-data-export-xml-attach { + background-image: url(../images/xml.png); +} diff --git a/plugins/views_data_export_plugin_style_export.inc b/plugins/views_data_export_plugin_style_export.inc index 934fb48..8e298d1 100644 --- a/plugins/views_data_export_plugin_style_export.inc +++ b/plugins/views_data_export_plugin_style_export.inc @@ -24,6 +24,10 @@ class views_data_export_plugin_style_export extends views_plugin_style { 'default' => $this->definition['export feed text'], 'translatable' => TRUE, ); + $options['link_only'] = array( + 'default' => FALSE, + 'translatable' => FALSE, + ); $options['provide_file'] = array( 'default' => FALSE, 'translatable' => FALSE, @@ -56,6 +60,12 @@ class views_data_export_plugin_style_export extends views_plugin_style { '#default_value' => $this->options['attach_text'], '#description' => t('This text is used in building the feed link. By default it is the "alt" text for the feed image.'), ); + $form['link_only'] = array( + '#type' => 'checkbox', + '#title' => t('Link only'), + '#default_value' => $this->options['link_only'], + '#description' => t('By deselecting this, the attach text will be displayed as a link instead of the feed image.'), + ); $form['provide_file'] = array( '#type' => 'checkbox', '#title' => t('Provide as file'), @@ -166,10 +176,11 @@ class views_data_export_plugin_style_export extends views_plugin_style { $query['attach'] = $display_id; } $this->view->feed_icon .= theme($theme_pattern, array( - 'image_path' => $this->definition['export feed icon'], + 'type' => $type, 'url' => $this->view->get_url(NULL, $path), 'query' => $query, 'text' => $this->options['attach_text'], + 'link_only' => $this->options['link_only'] ) ); } diff --git a/theme/views_data_export.theme.inc b/theme/views_data_export.theme.inc index 1a4f7d3..de71526 100644 --- a/theme/views_data_export.theme.inc +++ b/theme/views_data_export.theme.inc @@ -41,12 +41,18 @@ function theme_views_data_export_message($var) { */ function theme_views_data_export_feed_icon($variables) { extract($variables, EXTR_SKIP); - $url_options = array('html' => true); if ($query) { $url_options['query'] = $query; } - $image = theme('image', array('path' => $image_path, 'alt' => $text, 'title' => $text)); - return l($image, $url, $url_options); + $url_options['attributes']['class'] = "views-data-export-$type-attach"; + if ($link_only) { + $url_options['attributes']['class'] .= "-without-icon"; + } + else { + $url_options['attributes']['title'] = $text; + } + + return l($text, $url, $url_options); } /** diff --git a/views_data_export.module b/views_data_export.module index d4088d7..ce90f64 100644 --- a/views_data_export.module +++ b/views_data_export.module @@ -19,6 +19,7 @@ function views_data_export_init() { // We have to include our theme preprocessors here until: // http://drupal.org/node/1096770 is fixed. module_load_include('inc', 'views_data_export', 'theme/views_data_export.theme'); + drupal_add_css( drupal_get_path('module','views_data_export') . '/css/views_data_export.css' ); } /** diff --git a/views_data_export.views.inc b/views_data_export.views.inc index c433c79..3625127 100644 --- a/views_data_export.views.inc +++ b/views_data_export.views.inc @@ -59,7 +59,6 @@ function views_data_export_views_plugins() { 'export feed type' => 'csv', 'export feed text' => 'CSV', 'export feed file' => '%view.csv', - 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/csv.png', 'additional themes' => array( 'views_data_export_csv_header' => 'style', 'views_data_export_csv_body' => 'style', @@ -75,7 +74,6 @@ function views_data_export_views_plugins() { 'export feed type' => 'doc', 'export feed text' => 'Word Document', 'export feed file' => '%view.doc', - 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/doc.png', 'additional themes' => array( 'views_data_export_doc_header' => 'style', 'views_data_export_doc_body' => 'style', @@ -91,7 +89,6 @@ function views_data_export_views_plugins() { 'export feed type' => 'txt', 'export feed text' => 'Plain Text Document', 'export feed file' => '%view.txt', - 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/txt.png', 'additional themes' => array( 'views_data_export_txt_header' => 'style', 'views_data_export_txt_body' => 'style', @@ -107,7 +104,6 @@ function views_data_export_views_plugins() { 'export feed type' => 'xls', 'export feed text' => 'XLS', 'export feed file' => '%view.xls', - 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/xls.png', 'additional themes' => array( 'views_data_export_xls_header' => 'style', 'views_data_export_xls_body' => 'style', @@ -123,7 +119,6 @@ function views_data_export_views_plugins() { 'export feed type' => 'xml', 'export feed text' => 'XML', 'export feed file' => '%view.xml', - 'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/xml.png', 'additional themes' => array( 'views_data_export_xml_header' => 'style', 'views_data_export_xml_body' => 'style',