Hello. Ive implemented the Skinr 7.x-2.x into my theme. It works ok. But there is a small issue that conflicts with my theme CSS.

Basicly i want to load the Skinr CSS after my theme CSS.

Why?
Because if the Skinr CSS is loaded before my theme CSS it gets overwritten and ignored. I have to use the css "!important" to style it and i dont want to use that. Css "!important" its a hack that sould be avoided.

I tried the 'weight' => '999' but it dosen't work (i think this weight has to deal with the skinr module and not the theme css loading order)

So how can i load the Skinr css after my theme CSS?

CommentFileSizeAuthor
#5 patch_commit_5c1bb72f0761.patch4.79 KBmoonray

Comments

moonray’s picture

The css includes take the same arguments as #attached (see docs for drupal_add_css()), so you should have full power over at what point it shows up. Try setting the group to 'CSS_THEME' as well as setting weight.

moonray’s picture

Status: Active » Fixed

Marking as fixed. Re-open if still an issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gausarts’s picture

Status: Closed (fixed) » Active

Hi,
Sorry to reopen.
I am trying to get this to work to no avail.
The code:

   $css_options = array('group' => CSS_THEME, 'weight' => 999);

  .....................
    'options' => array(
      'button_1' => array(
        'title' => t('Button 1 - arrow'),
        'class' => array('button-arrow'),
		'attached' => array(
		  'css' => array('css/button-arrow.css' => $css_options),
		),
      ),
  ........................


The css output:

css/button-arrow.css (Array, 9 elements)

    group (Integer) 100
    weight (Float) 101.067
    0 (String, 46 characters ) sites/all/themes/mytheme/skins/button/
    type (String, 4 characters ) file | (Callback) file();
    every_page (Boolean) FALSE
    media (String, 3 characters ) all
    preprocess (Boolean) TRUE
    data (String, 20 characters ) css/button-arrow.css
    browsers (Array, 2 elements)
        IE (Boolean) TRUE
        !IE (Boolean) TRUE

The error:

    Notice: Undefined offset: 0 in _skinr_add_path_to_files() (line 935 of G:\xampp\htdocs\drupal7\sites\all\modules\dev\skinr\skinr.module).
    Notice: Undefined offset: 0 in _skinr_add_path_to_files() (line 935 of G:\xampp\htdocs\drupal7\sites\all\modules\dev\skinr\skinr.module).
    Notice: Undefined offset: 0 in _skinr_add_path_to_files() (line 938 of G:\xampp\htdocs\drupal7\sites\all\modules\dev\skinr\skinr.module).

Ref: http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#attached
Any hint about the issue?

Thanks

UPDATE:
This one doesn't output error, but the weight + group are not applied:
'css' => array('data' => 'css/button-arrow.css', 'group' => CSS_THEME, 'weight' => 999),

moonray’s picture

Title: Load the Skinr CSS after the Theme style sheet » Notice in _skinr_add_path_to_files when attached CSS or JS file has advanced settings
Component: Module conflict » Code
Category: support » bug
Status: Active » Needs review
StatusFileSize
new4.79 KB

Well, looks like you found a bug. Your first example was correct, but the notices shouldn't happen.
Attached is the patch (including tests) that should fix the problem.

Note that there are 3 ways to include a CSS file:

<?php
    'attached' => array(
      'css' => array(
        'skinr_test.css',
        'skinr_test_advanced.css' => array('group' => CSS_THEME, 'weight' => 999),
        array('data' => 'skinr_test_data.css', 'group' => CSS_THEME, 'weight' => 999),
      ),
    ),
?>
moonray’s picture

Status: Needs review » Fixed

Committed. Please re-open if you still have issues.

gausarts’s picture

Status: Fixed » Reviewed & tested by the community

Thanks a lot. Works great now.

Before the patch I used a swap to the haystack via hook_css_alter:

  // --Move skins css to theme and add heavier weight
  foreach ($css as $key => $value) {
    if (strpos($key, 'skins') !== FALSE) {
      $css[$key]['group'] = CSS_THEME;
      $css[$key]['media'] = 'screen';
      $css[$key]['weight'] = 999;
    }
  }

The patch should allow more granular weights over a group of files as needed. Thanks

gausarts’s picture

Status: Reviewed & tested by the community » Fixed

Oops, you came early, sorry

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.