class sweaver_plugin_fontface in Sweaver 7
Same name and namespace in other branches
- 6 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('enabled = 1');
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;
}
}
}
// Unserialize first, serialize after.
if (!is_array($objects->property->all['font-family']->property_options)) {
$objects->property->all['font-family']->property_options = unserialize($objects->property->all['font-family']->property_options);
}
$objects->property->all['font-family']->property_options += $extra_fonts;
$objects->property->all['font-family']->property_options = serialize($objects->property->all['font-family']->property_options);
if (isset($objects->property->enabled['font-family'])) {
if (!is_array($objects->property->all['font-family']->property_options)) {
$objects->property->enabled['font-family']->property_options = unserialize($objects->property->enabled['font-family']->property_options);
}
$objects->property->enabled['font-family']->property_options += $extra_fonts;
$objects->property->enabled['font-family']->property_options = serialize($objects->property->enabled['font-family']->property_options);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
sweaver_plugin:: |
public | function | Return false to not show editor. | 1 |
sweaver_plugin:: |
public | function | Sweaver form. | 8 |
sweaver_plugin:: |
public | function | Sweaver css and js. | 9 |
sweaver_plugin:: |
public | function | Sweaver form render. | 3 |
sweaver_plugin:: |
public | function | Sweaver submit handler. | 6 |
sweaver_plugin:: |
public | function | Images handler. | 1 |
sweaver_plugin:: |
public | function | Init function. | 1 |
sweaver_plugin:: |
public | function | Menu registry. | 7 |
sweaver_plugin:: |
public | function | Return true to allow access and false to deny. | 1 |
sweaver_plugin:: |
public | function | Menu callback. | 6 |
sweaver_plugin:: |
public | function | Menu callback submit. | 2 |
sweaver_plugin:: |
public | function | Menu callback validate. | |
sweaver_plugin:: |
protected | function | Helper function render the popups. | |
sweaver_plugin:: |
public | function | Preprocess page function. | 1 |
sweaver_plugin:: |
public | function | Theme registry. | 1 |
sweaver_plugin_fontface:: |
public | function |
Sweaver dependencies. Overrides sweaver_plugin:: |
|
sweaver_plugin_fontface:: |
public | function |
Sweaver objects alter. Overrides sweaver_plugin:: |