1 layout.theme.inc template_preprocess_block_dynamic(&$variables)

Prepares variables for block-dynamic templates.

File

core/modules/layout/layout.theme.inc, line 569
Theme functions for the Layout module.

Code

function template_preprocess_block_dynamic(&$variables) {
  // Re-use all the preprocessing provided by the default block template.
  template_preprocess_block($variables);

  $block = $variables['block'];
  $style = $block->style;

  // Add the wrapper tag. Classes are set in template_preprocess_block().
  $variables['wrapper_tag'] = $style->settings['wrapper_tag'];

  // Add title tag and classes.
  $title_classes = explode(' ', $style->settings['title_classes']);
  foreach ($title_classes as $n => $class) {
    $title_classes[$n] = backdrop_clean_css_identifier($class, array());
  }
  $title_classes = array_filter($title_classes);
  $variables['title_tag'] = $style->settings['title_tag'];
  $variables['title_attributes'] = array();
  if (!empty($title_classes)) {
    $variables['title_attributes']['class'] = $title_classes;
  }

  // Add content tag and classes.
  $content_classes = explode(' ', $style->settings['content_classes']);
  foreach ($content_classes as $n => $class) {
    $content_classes[$n] = backdrop_clean_css_identifier($class, array());
  }
  $content_classes = array_filter($content_classes);
  $variables['content_tag'] = $style->settings['content_tag'];
  $variables['content_attributes'] = array();
  if (!empty($content_classes)) {
    $variables['content_attributes']['class'] = $content_classes;
  }
}