When you create a region in the custom Panels layout, you have an option to add a custom CSS class. A value entered here is saved with the Panel, but the rendered output doesn't include the class. The Aurora docs mention using hook_aurora_layout_attributes_alter() to add attributes, which is fine, but without this custom class, you must rely on the internally generated IDs (main-row, 1, 2, etc.) to reference the regions so that you can add the attributes. This seems a little ambiguous and I have concerns about it working consistently in all cases. Are these concerns valid and/or is there a more proper way to reference the regions individually so that they can be assigned to specific grids?

Comments

cameron prince’s picture

I took this a little further and can now confirm with certainty that using hook_aurora_layout_attributes_alter() doesn't solve the problem.

The following hook was added to my sub-theme's template.php.

/**
 * Implements hook_aurora_layout_attributes_alter().
 */
function MYTHEME_aurora_layout_attributes_alter(&$attributes) {
  if (isset($attributes['id'])) {
    if (!isset($attributes['classes'])) {
      $attributes['classes'] = array();
    }
    switch ($attributes['id']) {
      case 'main-row':
        $attributes['classes'][] = 'col-1';
        break;
      case 1:
        $attributes['classes'][] = 'col-2';
        break;
      case 2:
        $attributes['classes'][] = 'col-3';
        break;
    }
  }
}

Using this allows me to do this in my layouts partial:

#home .col-1 {
  @include grid-span(4, 1);
}
#home .col-2 {
  @include grid-span(4, 5);
}
#home .col-3 {
  @include grid-span(4, 9);
}

This all works fine until a second panel page is added. Since the $attributes array provides no element for us to determine the active panel page, the new classes are added to them all.

I hope I'm missing something here, but without the custom class per region, this seems really handicapped.

DamienMcKenna’s picture

Component: Documentation » Code
Category: support » bug

This is a bug, any classes added via the Panels interface should be displayed in the theme.

iamcarrico’s picture

Status: Active » Fixed

After talking it over with @snugug, we are removing the panels layout from the next release.

Why? Because this is a poor way of implementing this functionality, and snugug did not realize it. Instead, you should create your own custom panels layout, and do the code there. This has a couple HUGE advantages:

  • Designers will have complete control of the layout and code, this will be easier for those not familiar with Drupal
  • The layout will be within code, and not within a database.
  • We will be using the system how it is meant to be used, and not be fighting it

Some links on how to do this:
https://drupal.org/node/495654
http://drupalize.me/videos/custom-panels-layouts

DamienMcKenna’s picture

Title: Custom CSS classes missing from regions provided by Panels layout » Document the removal of Panels integration
Component: Code » Documentation
Category: bug » task
Status: Fixed » Active

Given that the existing release includes this, you need to add some documentation to the theme's README.txt file and project page explaining why and provide some links.

iamcarrico’s picture

Status: Active » Fixed

The project page already included information, I added the links above. I also pushed that information into the README.md, and within the theme is an example of a sample layout. I might attempt to even add this to the compass extension somehow.

iamcarrico’s picture

Related: this is also why we are not pushing the release for a week.

iamcarrico’s picture

Related: this is also why we are not pushing the release for a week.

DamienMcKenna’s picture

@ChinggizKhan: Sounds good :)

Status: Fixed » Closed (fixed)

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