function whatsappshare_preprocess_html in Whatsapp Share 8
Same name and namespace in other branches
- 4.0.x whatsappshare.module \whatsappshare_preprocess_html()
- 1.0.x whatsappshare.module \whatsappshare_preprocess_html()
Implements hook_preprocess_html().
File
- ./
whatsappshare.module, line 12
Code
function whatsappshare_preprocess_html(&$variables) {
global $base_url;
$whatsappshareConfig = \Drupal::config('whatsappshare.adminsettings');
$whatsappshare_button_text = $whatsappshareConfig
->get('whatsappshare_button_text');
$whatsappshare_button_size = $whatsappshareConfig
->get('whatsappshare_button_size');
$whatsappshare_sharing_text = $whatsappshareConfig
->get('whatsappshare_sharing_text');
$whatsappshare_sharing_location = $whatsappshareConfig
->get('whatsappshare_sharing_location');
$variables['#attached']['library'][] = 'whatsappshare/whatsappshare';
$variables['#attached']['drupalSettings']['whatsappshare']['whatsappshareJS']['page_url'] = $base_url . \Drupal::request()
->getRequestUri();
$variables['#attached']['drupalSettings']['whatsappshare']['whatsappshareJS']['whatsappshare_button_text'] = $whatsappshare_button_text;
$variables['#attached']['drupalSettings']['whatsappshare']['whatsappshareJS']['whatsappshare_button_size'] = $whatsappshare_button_size;
$variables['#attached']['drupalSettings']['whatsappshare']['whatsappshareJS']['whatsappshare_sharing_text'] = $whatsappshare_sharing_text;
$variables['#attached']['drupalSettings']['whatsappshare']['whatsappshareJS']['whatsappshare_sharing_location'] = $whatsappshare_sharing_location;
}