You are here

function social_sharing_preprocess_block_shariff in Open Social 8.6

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_sharing/social_sharing.module \social_sharing_preprocess_block_shariff()
  2. 8.4 modules/social_features/social_sharing/social_sharing.module \social_sharing_preprocess_block_shariff()
  3. 8.5 modules/social_features/social_sharing/social_sharing.module \social_sharing_preprocess_block_shariff()
  4. 8.7 modules/social_features/social_sharing/social_sharing.module \social_sharing_preprocess_block_shariff()
  5. 8.8 modules/social_features/social_sharing/social_sharing.module \social_sharing_preprocess_block_shariff()
  6. 10.3.x modules/social_features/social_sharing/social_sharing.module \social_sharing_preprocess_block_shariff()
  7. 10.0.x modules/social_features/social_sharing/social_sharing.module \social_sharing_preprocess_block_shariff()
  8. 10.1.x modules/social_features/social_sharing/social_sharing.module \social_sharing_preprocess_block_shariff()
  9. 10.2.x modules/social_features/social_sharing/social_sharing.module \social_sharing_preprocess_block_shariff()

Implements hook_preprocess().

File

modules/social_features/social_sharing/social_sharing.module, line 67
The Social Sharing module.

Code

function social_sharing_preprocess_block_shariff(&$variables, $hook) {

  /** @var \Drupal\Core\Template\Attribute $data_attributes */
  $data_attributes = $variables['data_attributes'];

  // Make an array representation so we can add data attributes.
  $data = $data_attributes
    ->toArray();

  // Add buttons style.
  $data['data-button-style'] = 'info';

  // Put it back as attribute, so it can be rendered.
  $variables['data_attributes'] = new Attribute($data);
}