-
Notifications
You must be signed in to change notification settings - Fork 619
/
GlobalsVariable.php
89 lines (82 loc) · 1.87 KB
/
GlobalsVariable.php
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
namespace Craft;
/**
* Globals functions.
*
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @copyright Copyright (c) 2014, Pixel & Tonic, Inc.
* @license http://craftcms.com/license Craft License Agreement
* @see http://craftcms.com
* @package craft.app.variables
* @since 1.0
*/
class GlobalsVariable
{
// Public Methods
// =========================================================================
/**
* Returns all global sets.
*
* @param string|null $indexBy
*
* @return array
*/
public function getAllSets($indexBy = null)
{
return craft()->globals->getAllSets($indexBy);
}
/**
* Returns all global sets that are editable by the current user.
*
* @param string|null $indexBy
* @param string|null $localeId
*
* @return array
*/
public function getEditableSets($indexBy = null, $localeId = null)
{
return craft()->globals->getEditableSets($indexBy, $localeId);
}
/**
* Returns the total number of global sets.
*
* @return int
*/
public function getTotalSets()
{
return craft()->globals->getTotalSets();
}
/**
* Returns the total number of global sets that are editable by the current user.
*
* @return int
*/
public function getTotalEditableSets()
{
return craft()->globals->getTotalEditableSets();
}
/**
* Returns a global set by its ID.
*
* @param int $globalSetId
* @param string|null $localeId
*
* @return GlobalSetModel|null
*/
public function getSetById($globalSetId, $localeId = null)
{
return craft()->globals->getSetById($globalSetId, $localeId);
}
/**
* Returns a global set by its handle.
*
* @param string $globalSetHandle
* @param string|null $localeId
*
* @return GlobalSetModel|null
*/
public function getSetByHandle($globalSetHandle, $localeId = null)
{
return craft()->globals->getSetByHandle($globalSetHandle, $localeId);
}
}