tailwindcss.theme 761 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
<?php

/**
 * @file
 * Functions to support theming in the Tailwind CSS theme.
 */

/**
 * Implements hook_preprocess_HOOK().
 */
function tailwindcss_preprocess_block(&$variables) {
12
  if (tailwindcss_get_active_theme() == 'tailwindcss' && $variables['base_plugin_id'] == 'system_branding_block') {
13 14 15 16 17 18
    $variables['site_logo'] = '';
    if ($variables['content']['site_logo']['#access'] && $variables['content']['site_logo']['#uri']) {
      $variables['site_logo'] = str_replace('.svg', '.png', $variables['content']['site_logo']['#uri']);
    }
  }
}
19 20 21 22 23 24 25 26 27 28 29


/**
 * Get the active theme.
 *
 * @return string
 *   The name of the active theme.
 */
function tailwindcss_get_active_theme() {
  return \Drupal::service('theme.manager')->getActiveTheme()->getName();
}