-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrainblocks.module
More file actions
32 lines (28 loc) · 860 Bytes
/
brainblocks.module
File metadata and controls
32 lines (28 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
* @file
* Hook implementations for brainblocks.
*/
/**
* Implements hook_page_attachments().
*
* @param array $attachments
*/
function brainblocks_page_attachments(array &$attachments) {
$xrb_address = _brainblocks_config('xrb_address');
$currency = _brainblocks_config('currency');
$amount = _brainblocks_config('amount');
$attachments['#attached']['drupalSettings']['brainblocks'] = ['xrb_address' => $xrb_address, 'currency' => $currency, 'amount' => $amount];
$attachments['#attached']['library'][] = 'brainblocks/main';
$attachments['#attached']['library'][] = 'brainblocks/brainblocks.brainblocks';
}
/**
* Helper function for returning config data from this module.
*
* @param $key
*
* @return array|mixed|null
*/
function _brainblocks_config($key) {
return \Drupal::config('brainblocks.settings')->get($key);
}