You are here

function template_preprocess_clean_markup_panels_clean_element in Clean Markup 7.2

Same name and namespace in other branches
  1. 7.3 modules/clean_markup_panels/plugins/styles/clean/clean_element.inc \template_preprocess_clean_markup_panels_clean_element()

Prepares variables for clean_markup_panels_clean_element.tpl.php.

File

modules/clean_markup_panels/plugins/styles/clean/clean_element.inc, line 233
Clean markup panels clean element panels style.

Code

function template_preprocess_clean_markup_panels_clean_element(&$vars) {
  $clean_markup = $vars['pane']->style['settings']['clean_markup'];

  // Outer wrapper.
  if ($clean_markup['pane_wrapper'] === 'none') {
    $vars['pane_wrapper'] = FALSE;
    $vars['pane_wrapper_tag'] = 'div';
  }
  else {
    $vars['pane_wrapper'] = TRUE;
    $vars['pane_wrapper_tag'] = $clean_markup['pane_wrapper'];
  }

  // Inner div.
  $vars['inner_wrapper'] = FALSE;
  if ($clean_markup['enable_inner_div'] == TRUE) {
    $vars['inner_wrapper'] = TRUE;
  }

  // Custom CSS classes.
  $vars['classes_array'][] = $vars['pane']->style['settings']['clean_markup']['additional_pane_classes'];
  if ($clean_markup['additional_pane_classes']) {
    $vars['clean_markup_classes'] = ' ' . ctools_context_keyword_substitute($clean_markup['additional_pane_classes'], array(), $vars['display']->context);
  }
  else {
    $vars['clean_markup_classes'] = '';
  }

  // Custom attributes.
  if (module_exists('token')) {
    $vars['additional_attributes'] = token_replace($clean_markup['additional_pane_attributes'], array(
      'global',
    ));
  }
  else {
    $vars['additional_attributes'] = $clean_markup['additional_pane_attributes'];
  }
  $vars['additional_attributes'] = ctools_context_keyword_substitute($vars['additional_attributes'], array(), $vars['display']->context);

  // Pad additional_attributes.
  if (!empty($vars['additional_attributes'])) {
    $vars['additional_attributes'] = str_pad($vars['additional_attributes'], strlen($vars['additional_attributes']) + 2, ' ', STR_PAD_BOTH);
  }

  // Pane title element.
  $vars['title_wrapper'] = $clean_markup['title_wrapper'];

  // Hide panel pane title with element-invisible class.
  if ($clean_markup['title_hide'] == TRUE) {
    $vars['title_attributes_array']['class'][] = 'element-invisible';
  }

  // Content wrapper.
  if ($clean_markup['content_wrapper'] === 'none') {
    $vars['content_wrapper'] = FALSE;
    $vars['content_wrapper_tag'] = 'div';
  }
  else {
    $vars['content_wrapper'] = TRUE;
    $vars['content_wrapper_tag'] = $clean_markup['content_wrapper'];
  }

  // Add default pane content class.
  $vars['content_attributes_array']['class'][] = 'pane-content';
  return template_preprocess_panels_pane($vars);
}