/
Set.php
83 lines (74 loc) · 1.73 KB
/
Set.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
<?php
namespace Concrete\Core\StyleCustomizer;
use Concrete\Core\StyleCustomizer\Style\Style;
class Set
{
/**
* The name of the style customizer set.
*
* @var string
*/
protected $name;
/**
* The list of styles associated to this set.
*
* @var \Concrete\Core\StyleCustomizer\Style\Style[]
*/
protected $styles = [];
/**
* Set the name of the style customizer set.
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* Get the name of the style customizer set.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Get the display name for this style set (localized and escaped accordingly to $format).
*
* @param string $format = 'html'
* Escape the result in html format (if $format is 'html').
* If $format is 'text' or any other value, the display name won't be escaped.
*
* @return string
*/
public function getDisplayName($format = 'html')
{
$value = tc('StyleSetName', $this->getName());
switch ($format) {
case 'html':
return h($value);
case 'text':
default:
return $value;
}
}
/**
* Add a style to this set.
*
* @param \Concrete\Core\StyleCustomizer\Style\Style $style
*/
public function addStyle(Style $style)
{
$this->styles[] = $style;
}
/**
* Get the list of styles associated to this set.
*
* @return \Concrete\Core\StyleCustomizer\Style\Style[]
*/
public function getStyles()
{
return $this->styles;
}
}