check for simplenews.css in theme

catorghans - June 11, 2009 - 09:05
Project:Simplenews
Version:6.x-1.0-rc6
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I think a check for a simplenews.css file in the theme would be handy, that one could override css sessions for the HTML email sent.

I solved it by using my own function in the template.php

function phptemplate_preprocess_simplenews_newsletter_body(&$variables) {
  if (file_exists(path_to_theme()."/simplenews.css")) drupal_add_css(path_to_theme()."/simplenews.css", 'theme');
}

But I think it would be a simple and very userfriendly addition to simplenews functionality if that line was in the simplenews preprocess function already..

function template_preprocess_simplenews_newsletter_body(&$variables) {
  if (file_exists(path_to_theme()."/simplenews.css")) drupal_add_css(path_to_theme()."/simplenews.css", 'theme');

  $variables['title'] = check_plain($variables['node']->title);
  $variables['body'] = $variables['node']->body;
}

If someone wants to override the css, it is very easy to do. If not, no extra css is added.

AttachmentSize
simplenewscss.patch594 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.