class HtmlFontSizeModifier in Modifiers Pack 8
Provides a Modifier to set the HTML font size on an element.
Plugin annotation
@Modifier(
id = "html_font_size_modifier",
label = @Translation("HTML Font Size Modifier"),
description = @Translation("Provides a Modifier to set the HTML font size on an element."),
)
Hierarchy
- class \Drupal\modifiers_html_font_size\Plugin\modifiers\HtmlFontSizeModifier extends \Drupal\modifiers\ModifierPluginBase
Expanded class hierarchy of HtmlFontSizeModifier
1 file declares its use of HtmlFontSizeModifier
- HtmlFontSizeModifierTest.php in modules/
modifiers_html_font_size/ tests/ src/ Unit/ HtmlFontSizeModifierTest.php
File
- modules/
modifiers_html_font_size/ src/ Plugin/ modifiers/ HtmlFontSizeModifier.php, line 17
Namespace
Drupal\modifiers_html_font_size\Plugin\modifiersView source
class HtmlFontSizeModifier extends ModifierPluginBase {
/**
* {@inheritdoc}
*/
public static function modification($selector, array $config) {
if (!empty($config['fonts_base_size'])) {
$media = parent::getMediaQuery($config);
$css[$media][$selector][] = 'font-size:' . $config['fonts_base_size'] . '!important';
return new Modification($css);
}
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HtmlFontSizeModifier:: |
public static | function |