function easy_social_preprocess_easy_social_linkedin in Easy Social 8.3
Same name and namespace in other branches
- 8.4 easy_social.module \easy_social_preprocess_easy_social_linkedin()
Implements hook_preprocess_HOOK() for easy_social_linkedin theme.
See also
theme_easy_social_linkedin()
File
- ./
easy_social.module, line 333 - Easy Social module.
Code
function easy_social_preprocess_easy_social_linkedin(&$variables, &$hook) {
//ToDo: Figure out how to pass variables to the JS using DrupalSettings
if ($variables['lang'] !== 'en') {
$script = <<<JS
window.___gcfg = {lang: '{<span class="php-variable">$variables</span>[<span class="php-string">'lang'</span>]}'};
JS;
}
$hook = str_replace('easy_social_', 'easy_social.', $hook);
$attributes = array(
'type' => 'IN/Share',
);
if ($config = \Drupal::config($hook)) {
// @TODO load contextual config.
$widget_params = $config
->get();
if (!empty($variables['url'])) {
$attributes['data-url'] = $variables['url'];
}
if (isset($widget_params['counter']) && $widget_params['counter'] !== 'none') {
$attributes['data-counter'] = $widget_params['counter'];
}
}
$variables['attributes'] = $attributes;
}