function easy_social_get_widgets in Easy Social 7.2
Same name and namespace in other branches
- 8.4 easy_social.module \easy_social_get_widgets()
- 8.3 easy_social.module \easy_social_get_widgets()
Returns a list of enabled Easy Social widgets.
Return value
array
3 calls to easy_social_get_widgets()
- easy_social_admin_summary in includes/
easy_social.admin.inc - Form callback. Displays Easy Social Summary.
- _easy_social_get_options in ./
easy_social.module - Returns Easy Social options for use in settings forms.
- _easy_social_render_widgets in ./
easy_social.module - Return an array of rendered Easy Social Widgets
File
- ./
easy_social.module, line 530 - Easy social module.
Code
function easy_social_get_widgets() {
static $static;
// First check static cache.
if (!isset($static)) {
// Then check Drupal's cache.
$cache = cache_get('easy_social_widgets');
if (isset($cache->data) && is_array($cache->data)) {
$return = $cache->data;
}
else {
$return = array();
foreach (module_implements('easy_social_widget') as $name) {
$widgets = module_invoke($name, 'easy_social_widget');
$return = array_merge($return, $widgets);
}
// Add widgets to easy_social_global_order variable.
$order = variable_get_value('easy_social_global_order');
$modified = FALSE;
foreach ($return as $name => $array) {
if (!in_array($name, $order, TRUE)) {
$order[] = $name;
$modified = TRUE;
}
}
if ($modified) {
variable_set('easy_social_global_order', $order);
cache_set('easy_social_widgets', $return, 'cache', CACHE_TEMPORARY);
}
}
$static = $return;
}
return $static;
}