Skip to content

Commit

Permalink
Merge pull request #194 from isubit/D8ISUTHEME-183
Browse files Browse the repository at this point in the history
D8ISUTHEME-183 Add block type classes to blocks
  • Loading branch information
sacarney committed May 3, 2022
2 parents e6cb98c + bc51158 commit 97b0f24
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion iastate_theme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,22 @@ function iastate_theme_preprocess(&$variables, $hook) {
/*
* Implements theme_preprocess_block().
*
* Make theme settings available in block templates
*/

function iastate_theme_preprocess_block(&$variables) {
// Make theme settings available in block templates
$variables['iastate_logo_alt'] = theme_get_setting('iastate_logo_alt');
$variables['iastate_logo_width'] = theme_get_setting('iastate_logo_width');
$variables['iastate_logo_height'] = theme_get_setting('iastate_logo_height');
$variables['iastate_logo_alt'] = theme_get_setting('iastate_logo_alt');
$variables['is_default_logo'] = \Drupal::config('iastate_theme.settings')->get('logo.use_default');
$variables['iastate_logo_url'] = theme_get_setting('iastate_logo_url');

// Make block type available in block templates
if ($variables['elements']['#base_plugin_id'] == 'block_content') {
$blockType = strtr($variables['content']['#block_content']->bundle(), '_', '-');
$variables['attributes']['class'][] = 'block-type_' . $blockType;
}
}

/*
Expand Down

0 comments on commit 97b0f24

Please sign in to comment.