Merge pull request #18512 from eileenmcnaughton/export_classes
[civicrm-core.git] / CRM / Core / Resources / Bundle.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * Class CRM_Core_Resources_Bundle
14 *
15 * A bundle is a collection of web resources with the following details:
16 * - Only scripts, styles, and settings are allowed. Free-form markup is not.
17 * - Resources *may* have a 'region'. Hopefully, this is not necessary for most bundles.
18 * - If no 'region' is given, then CRM_Core_Resources will pick a default at activation time.
19 */
20 class CRM_Core_Resources_Bundle implements CRM_Core_Resources_CollectionInterface {
21
22 use CRM_Core_Resources_CollectionTrait;
23
24 /**
25 * Symbolic name for this bundle.
26 *
27 * @var string|null
28 */
29 public $name;
30
31 /**
32 * @param string|NULL $name
33 * @param string[]|NULL $types
34 * List of resource-types to permit in this bundle. NULL for a default list.
35 */
36 public function __construct($name = NULL, $types = NULL) {
37 $this->name = $name;
38 $this->types = $types ?: ['script', 'scriptFile', 'scriptUrl', 'settings', 'style', 'styleFile', 'styleUrl'];
39 }
40
41 }