You are here

function template_preprocess_panels_myriad in Clean Markup 7.2

Same name and namespace in other branches
  1. 7.3 modules/clean_markup_panels/plugins/layouts/myriad/myriad.inc \template_preprocess_panels_myriad()

Prepares variables for panels_myriad templates.

Default template: panels-myriad.tpl.php.

Parameters

array $variables: An associative array containing:

  • $content: An array of content, each item in the array is keyed to one panel of the layout.

File

modules/clean_markup_panels/plugins/layouts/myriad/myriad.inc, line 49
Define the Myriad style plugin.

Code

function template_preprocess_panels_myriad(array &$variables) {
  $variables['row_one_regions'] = 0;
  $variables['row_two_regions'] = 0;
  $variables['row_three_regions'] = 0;
  $variables['row_four_regions'] = 0;
  $variables['row_five_regions'] = 0;
  $variables['total_rows'] = 0;

  // Calculated output for first row wrapper.
  if ($variables['content']['one_first']) {
    $variables['row_one_regions']++;
  }
  if ($variables['content']['one_second']) {
    $variables['row_one_regions']++;
  }
  if ($variables['content']['one_third']) {
    $variables['row_one_regions']++;
  }
  if ($variables['content']['one_fourth']) {
    $variables['row_one_regions']++;
  }
  if ($variables['row_one_regions'] > 0) {
    $variables['total_rows']++;
  }

  // Calculated output for first row wrapper.
  if ($variables['content']['two_first']) {
    $variables['row_two_regions']++;
  }
  if ($variables['content']['two_second']) {
    $variables['row_two_regions']++;
  }
  if ($variables['content']['two_third']) {
    $variables['row_two_regions']++;
  }
  if ($variables['content']['two_fourth']) {
    $variables['row_two_regions']++;
  }
  if ($variables['row_two_regions'] > 0) {
    $variables['total_rows']++;
  }

  // Calculated output for third row wrapper.
  if ($variables['content']['three_first']) {
    $variables['row_three_regions']++;
  }
  if ($variables['content']['three_second']) {
    $variables['row_three_regions']++;
  }
  if ($variables['content']['three_third']) {
    $variables['row_three_regions']++;
  }
  if ($variables['content']['three_fourth']) {
    $variables['row_three_regions']++;
  }
  if ($variables['row_three_regions'] > 0) {
    $variables['total_rows']++;
  }

  // Calculated output for fourth row wrapper.
  if ($variables['content']['four_first']) {
    $variables['row_four_regions']++;
  }
  if ($variables['content']['four_second']) {
    $variables['row_four_regions']++;
  }
  if ($variables['content']['four_third']) {
    $variables['row_four_regions']++;
  }
  if ($variables['content']['four_fourth']) {
    $variables['row_four_regions']++;
  }
  if ($variables['row_four_regions'] > 0) {
    $variables['total_rows']++;
  }

  // Calculated output for fifth row wrapper.
  if ($variables['content']['five_first']) {
    $variables['row_five_regions']++;
  }
  if ($variables['content']['five_second']) {
    $variables['row_five_regions']++;
  }
  if ($variables['content']['five_third']) {
    $variables['row_five_regions']++;
  }
  if ($variables['content']['five_fourth']) {
    $variables['row_five_regions']++;
  }
  if ($variables['row_five_regions'] > 0) {
    $variables['total_rows']++;
  }

  // Construct an ID/Class attributes.
  $variables['panel_classes'] = 'panel-display panel-myriad-layout clearfix';
  if ($variables['css_id']) {
    $variables['panel_id'] = ' id="' . $variables['css_id'] . '"';
    $variables['panel_classes'] .= ' ' . $variables['css_id'];
  }
  else {
    $variables['panel_id'] = '';
  }
}