You are here

function hook_improved_theme_settings_add in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 modules/custom/improved_theme_settings/improved_theme_settings.api.php \hook_improved_theme_settings_add()
  2. 10.3.x modules/custom/improved_theme_settings/improved_theme_settings.api.php \hook_improved_theme_settings_add()
  3. 10.0.x modules/custom/improved_theme_settings/improved_theme_settings.api.php \hook_improved_theme_settings_add()
  4. 10.2.x modules/custom/improved_theme_settings/improved_theme_settings.api.php \hook_improved_theme_settings_add()

Allows modules to add additional CSS based on theme settings.

Parameters

string $theme: The name of the them that's being rendered.

Return value

string Returns a string that will be added as CSS.

1 invocation of hook_improved_theme_settings_add()
improved_theme_settings_page_attachments in modules/custom/improved_theme_settings/improved_theme_settings.module
Implements hook_page_attachments().

File

modules/custom/improved_theme_settings/improved_theme_settings.api.php, line 24
Hooks provided by the improved_theme_settings module.

Code

function hook_improved_theme_settings_add(string $theme) {
  $style_to_add = '';
  $card_radius = improved_theme_settings_get_setting('card_radius', $theme);
  if ($card_radius >= 0) {
    $style_to_add .= '
      .my-custom-selector {
        border-radius: ' . $card_radius . 'px;
      }
    ';
  }
  return $style_to_add;
}