Apply new Skin ( creating .inc file)

Please register or log in to post to the forums
6 replies [Last post]
frixos
frixos's picture
Offline
Joined: 2011-11-08
Posts: 13
Apply new Skin ( creating .inc file)

Hi.

I have created a new grid layout for 980px - 12 columns and i followed the instructions for applying thw new skin in Drupal 7.

so i have created a new inc file named baladeur_theme.inc and inside the file i put the following code

function baladeur_theme_fusion_apply_skin_baladeur_theme_info(
$skins['fusion_skins_grid12_width'] = array(
'title' => t('Width (12 column grid for baladeur)'),
'description' => t("Change the width of this block. Fluid grid % widths are relative to the parent region's width. Default widths: sidebar blocks default to the sidebar width; in other regions width is divided equally among all blocks."),
'type' => 'select',
'group' => 'fusion_layout',
'theme hooks' => array('block'),
'default status' => TRUE,
'options' => _fusion_skins_grid_options(12, 980),
);

is there something wrong in the code?
I cant load the new skin.

Thank you.

sheena
TopNotchThemer
sheena's picture
Offline
Joined: 2010-02-09
Posts: 1600

First, it is not necessary for you to create a new Skin set for your custom grid. Since it uses 12 units, you can simply use the 12-unit grid width Skins that come bundled with Fusion Core. Your grid's CSS file will override Fusion Core's grid file and update the unit widths to match the overall width that you define instead of 960px. The descriptions of the widths on the drop-down selector will be off,but the actual output in the theme will be correct.

In addition, you can not have a 12-column, 980px wide grid, since 980px is not equally divisible by 12. You could have a 12-column, 984px wide grid, though. I suggest you look into Fusion Accelerator's grid tools to help you generate your custom grid.

If you do want to create that custom set of skins, there are a few issues with the code you posted here. It does look like some of our documentation is incorrect, so we are working on that. Here is an overview of the mistakes I see in your code, most of which need to be corrected in our documentation as well:

First, it looks like your syntax for defining the function is wrong, although that may be because of HTML filtering in the forum. Next time, be sure to wrap your code in <code> tags when posting in the forum, so that we can see all the proper formatting.

I assume the name of your theme is "baladeur_theme". What is the name of your skins Plugin? i.e. the folder that this .inc file is in? It cannot have the same name as your theme, it will need to be named something like "baladeur_theme_skins". So, your file structure would look like this:

- baladeur_theme
-- skins
--- baladeur_theme_skins
---- baladeur_theme_skins.inc

and then, the function name for defining your skins in baladeur_theme_skins.inc would be:

function baladeur_theme_fusion_apply_skin_baladeur_theme_skins_info() {
  // skins go here
}

next you are missing two important components of the plugin info function. First, you have not created the variable $skins and you are not returning that variable, so the results of the function would always be Null. Also, you should name your skin something different that Fusion core's skin. Let's add those two parts to the function I created above:

function baladeur_theme_fusion_apply_skin_baladeur_theme_skins_info() {
 
  $skins = array(); 

  $skins['baladeur_theme_skins_grid12_width'] = array(
    // skin options go here
  );

  return $skins;

}

Lastly, the function _fusion_skins_grid_options() that you are calling to define your Skin options is only available in Fusion Core - it is an internal function and cannot be accessed outside of Fusion Core's core.inc file. You will need to either copy this function definition out of Fusion core's core.inc file and into your own baladeur_theme_skins.inc file, or you will need to manually create each option for your grid:

function baladeur_theme_fusion_apply_skin_baladeur_theme_skins_info() {
 
  $skins = array(); 

  $skins['baladeur_theme_skins_grid12_width'] = array(
    'title' => t('Width (12 column grid for baladeur)'),
    'description' => t("Change the width of this block. Fluid grid % widths are relative to the parent region's width. Default widths: sidebar blocks default to the sidebar width; in other regions width is divided equally among all blocks."),
    'type' => 'select',
    'group' => 'fusion_layout',
    'theme hooks' => array('block'),
    'default status' => TRUE,
    'options' => array(
      'baladeur_theme_grid12_1' => array(
        'title' => t('1 unit wide ')
        'class' => array('grid12-1'),
      ),
      'baladeur_theme_grid12_2'=> array(
        'title' => t('2 unit wide ')
        'class' => array('grid12-2'),
      ), 
      // and so forth
    ),
);

  return $skins;

}

I hope that helps clear up some mistakes in our documentation. Let me know if you run into anymore problems or need more clarification.

Cheers,
Sheena

frixos
frixos's picture
Offline
Joined: 2011-11-08
Posts: 13

Hi Sheena and thank for your post.

I have figured this out and indeed there was some mistakes in your documentation.

I used a 984px grid with 12 columns but i didn't face any problem with the function _fusion_skins_grid_options() since i have other 10 columns in my grid.

So i can edit the skin of any block using my 12-columnm grid.

And lastly, in order to achieve what you have mentioned in your first paragraph, should i create the .inc file or it is not necessary? ( creating the grid's css files is enough?)

Thank you

sheena
TopNotchThemer
sheena's picture
Offline
Joined: 2010-02-09
Posts: 1600

I believe creating the CSS file for your grid in your sub-theme is all you need to do if you are using a 12 or 16 column grid. If you were making a grid with a different number of columns, then you would need to create the skin definition.

esmerel_lynette
TopNotchThemer
esmerel_lynette's picture
Offline
Joined: 2011-05-11
Posts: 176

Thanks for the report; I've fixed the documentation. Hopefully the next person will be less confused than you were. Sorry about that!

frixos
frixos's picture
Offline
Joined: 2011-11-08
Posts: 13

Thank you for your attention.

I have a last notice to make.

I have just updated to the latest recommended version of Views ( security update) and after installation i fatal error came in.

Undefinded function _fusion_skins_grid_options().

But after i clear my caches everything seems ok.

Is there maybe an issue?

Thank you

sheena
TopNotchThemer
sheena's picture
Offline
Joined: 2010-02-09
Posts: 1600

if clearing cached fixed it and it does not come back, then there is no problem.