You are here

function beautytips_page_attachments in BeautyTips 8

Implements hook_page_attachments().

File

./beautytips.module, line 14
Provides API for adding beautytips to pages.

Code

function beautytips_page_attachments(&$page) {
  $config = \Drupal::config('beautytips.basic');
  if ($config
    ->get('beautytips_always_add')) {
    $options = [];
    $selectors = $config
      ->get('beautytips_added_selectors_array');
    if (count($selectors)) {
      foreach ($selectors as $selector) {
        if (!empty($selector)) {
          $options[$selector]['cssSelect'] = $selector;
        }
      }
    }
    $options['.beautytips']['cssSelect'] = '.beautytips';
    beautytips_add_beautytips($page, $options);
  }
}