class sweaver_plugin_fontface in Sweaver 6
Same name and namespace in other branches
- 7 plugins/sweaver_plugin_fontface/sweaver_plugin_fontface.inc \sweaver_plugin_fontface
@file @font-face plugin.
Hierarchy
- class \sweaver_plugin
- class \sweaver_plugin_fontface
Expanded class hierarchy of sweaver_plugin_fontface
1 string reference to 'sweaver_plugin_fontface'
- _sweaver_sweaver_plugins in ./
sweaver.registry.inc - Sweaver plugins.
File
- plugins/
sweaver_plugin_fontface/ sweaver_plugin_fontface.inc, line 7 - @font-face plugin.
View source
class sweaver_plugin_fontface extends sweaver_plugin {
/**
* Sweaver dependencies.
*/
public function sweaver_dependencies() {
return array(
'fontyourface',
);
}
/**
* Sweaver objects alter.
*/
public function sweaver_objects_alter(&$objects) {
$extra_fonts = array();
$used_fonts = fontyourface_get_fonts();
foreach ($used_fonts as $font) {
if (module_exists($font->provider)) {
if (function_exists('fontyourface_font_css')) {
$extra_fonts[$font->css_family] = $font->name;
}
else {
$css_function = $font->provider . '_fontyourface_css';
$font_css = $css_function($font);
$extra_fonts[$font_css['font-family']] = $font->group_name;
}
}
}
$objects->property->all['font-family']->property_options += $extra_fonts;
if (isset($objects->property->enabled['font-family'])) {
$objects->property->enabled['font-family']->property_options += $extra_fonts;
}
}
}