I am trying to create a module for BD. The module is supposed to provide some options that affect CSS classes. I need to change CSS class parameters depending on the options set up by a user.  I wonder if there is some good way for BD to do this? The only way I found is to put CSS into <style> tag in the module's template file and change it by php injections.

Comments

Where do you want the class to appear?

The CSS class is part of views style plugin I am tryiing to make. So it should appear in views that use this module. I want to allow user change some parameters that are kept in CSS. For now I did the following:

1. Created a css file with static parameters and added it as file in template preprocessing function.

2. Created another css programatically with parameters that are changeable and added it as 'inline' css.

The code looks like this:

function template_preprocess_views_view_mymodule(&$vars) {

backdrop_add_css('static.css');

 $css = <<<"CSS"
  .selector {
    attribute: $value_to_change;
  }
CSS;

backdrop_add_css($css, array('type' => 'inline'));
}

Looks like it works but I am not sure if it the right way to do this in Backdrop?