Updated the Bootstrap theme.
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Provider / Custom.php
1 <?php
2
3 namespace Drupal\bootstrap\Plugin\Provider;
4
5 /**
6  * The "custom" CDN provider plugin.
7  *
8  * @ingroup plugins_provider
9  *
10  * @BootstrapProvider(
11  *   id = "custom",
12  *   label = @Translation("Custom"),
13  * )
14  */
15 class Custom extends ProviderBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   public function getAssets($types = NULL) {
21     $this->assets = [];
22
23     // If no type is set, return all CSS and JS.
24     if (!isset($types)) {
25       $types = ['css', 'js'];
26     }
27     $types = is_array($types) ? $types : [$types];
28
29     foreach ($types as $type) {
30       if ($setting = $this->theme->getSetting('cdn_custom_' . $type)) {
31         $this->assets[$type][] = $setting;
32       }
33       if ($setting = $this->theme->getSetting('cdn_custom_' . $type . '_min')) {
34         $this->assets['min'][$type][] = $setting;
35       }
36     }
37     return parent::getAssets($types);
38   }
39
40 }