forked from Tactics/TableBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColumnHeader.php
105 lines (87 loc) · 1.96 KB
/
ColumnHeader.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
namespace Tactics\TableBundle;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ColumnHeader implements ColumnHeaderInterface
{
/**
* @var $value String
*/
protected $value;
/**
* @var $column ColumnInterface
*/
protected $column;
/*
* @var $options array
*/
protected $options;
/**
* {@inheritdoc}
*/
public function __construct($value, array $options = array())
{
$this->value = $value;
$resolver = new OptionsResolver();
$this->configureOptions($resolver);
$this->options = $options;
$this->options = $resolver->resolve($options);
}
/**
* {@inheritdoc}
*/
public function getValue()
{
return $this->value;
}
/**
* {@inheritdoc}
*/
public function setValue($value)
{
$this->value = $value;
}
public function getOptions()
{
return $this->options;
}
public function getOption($name)
{
return isset($this->options[$name]) ? $this->options[$name] : null;
}
public function setOption($name, $value)
{
$this->options[$name] = $value;
}
/**
* {@inheritdoc}
*/
public function setColumn(ColumnInterface $column)
{
$this->column = $column;
}
/**
* {@inheritdoc}
*/
public function getColumn()
{
return $this->column;
}
/**
* {@inheritdoc}
*/
public function getType()
{
return 'default';
}
/**
* Sets the default options for this table.
*
* @param OptionsResolver $resolver The resolver for the options.
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefined(['route', 'type', 'value', 'sort', 'route_params', 'attributes'])
->setDefaults(array('attributes' => array(), 'sorter_namespace' => null));
}
}