function _easy_social_preprocess_widget in Easy Social 8.4
Same name and namespace in other branches
- 8.3 easy_social.module \_easy_social_preprocess_widget()
Custom pre-process function, used to add settings for widgets.
See also
easy_social_theme_registry_alter()
1 string reference to '_easy_social_preprocess_widget'
- easy_social_theme_registry_alter in ./
easy_social.module - Implements hook_theme_registry_alter().
File
- ./
easy_social.module, line 381 - Easy Social module.
Code
function _easy_social_preprocess_widget(&$variables, $hook) {
global $base_url;
$widget = str_replace("easy_social_", "", $hook);
$config = Drupal::config('easy_social.settings');
$variables['async'] = $config
->get('global.async');
$definitions = easy_social_get_widgets();
$variables['url'] = $base_url . Url::fromRoute('<current>')
->toString();
// @TODO get current title.
//$variables['title'] = 'Test';
// @TODO get current language from context or fallback to site default.
if (!isset($variables['lang']) || empty($variables['lang'])) {
$variables['lang'] = 'en';
}
}