1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yajra\DataTables\Html\Options\Plugins; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* DataTables - Responsive plugin option builder. |
7
|
|
|
* |
8
|
|
|
* @see https://datatables.net/extensions/responsive |
9
|
|
|
* @see https://datatables.net/reference/option/responsive |
10
|
|
|
* @see https://datatables.net/reference/option/#responsive |
11
|
|
|
*/ |
12
|
|
|
trait Responsive |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Set responsive option value. |
16
|
|
|
* |
17
|
|
|
* @param bool|array $value |
18
|
|
|
* @return $this |
19
|
|
|
* @see https://datatables.net/reference/option/responsive |
20
|
|
|
*/ |
21
|
|
|
public function responsive($value = true) |
22
|
|
|
{ |
23
|
|
|
$this->attributes['responsive'] = $value; |
|
|
|
|
24
|
|
|
|
25
|
|
|
return $this; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Set responsive breakpoints option value. |
30
|
|
|
* |
31
|
|
|
* @param mixed $value |
32
|
|
|
* @return $this |
33
|
|
|
* @see https://datatables.net/reference/option/responsive.breakpoints |
34
|
|
|
*/ |
35
|
|
|
public function responsiveBreakpoints($value) |
36
|
|
|
{ |
37
|
|
|
$this->attributes['responsive']['breakpoints'] = $value; |
38
|
|
|
|
39
|
|
|
return $this; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Set responsive details option value. |
44
|
|
|
* |
45
|
|
|
* @param mixed $value |
46
|
|
|
* @return $this |
47
|
|
|
* @see https://datatables.net/reference/option/responsive.details |
48
|
|
|
*/ |
49
|
|
|
public function responsiveDetails($value) |
50
|
|
|
{ |
51
|
|
|
$this->attributes['responsive']['details'] = $value; |
52
|
|
|
|
53
|
|
|
return $this; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Set responsive details display option value. |
58
|
|
|
* |
59
|
|
|
* @param mixed $value |
60
|
|
|
* @return $this |
61
|
|
|
* @see https://datatables.net/reference/option/responsive.details.display |
62
|
|
|
*/ |
63
|
|
|
public function responsiveDetailsDisplay($value) |
64
|
|
|
{ |
65
|
|
|
$this->attributes['responsive']['details']['display'] = $value; |
66
|
|
|
|
67
|
|
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Set responsive details renderer option value. |
72
|
|
|
* |
73
|
|
|
* @param mixed $value |
74
|
|
|
* @return $this |
75
|
|
|
* @see https://datatables.net/reference/option/responsive.details.renderer |
76
|
|
|
*/ |
77
|
|
|
public function responsiveDetailsRenderer($value) |
78
|
|
|
{ |
79
|
|
|
$this->attributes['responsive']['details']['renderer'] = $value; |
80
|
|
|
|
81
|
|
|
return $this; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Set responsive details target option value. |
86
|
|
|
* |
87
|
|
|
* @param mixed $value |
88
|
|
|
* @return $this |
89
|
|
|
* @see https://datatables.net/reference/option/responsive.details.target |
90
|
|
|
*/ |
91
|
|
|
public function responsiveDetailsTarget($value) |
92
|
|
|
{ |
93
|
|
|
$this->attributes['responsive']['details']['target'] = $value; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Set responsive details type option value. |
100
|
|
|
* |
101
|
|
|
* @param mixed $value |
102
|
|
|
* @return $this |
103
|
|
|
* @see https://datatables.net/reference/option/responsive.details.type |
104
|
|
|
*/ |
105
|
|
|
public function responsiveDetailsType($value) |
106
|
|
|
{ |
107
|
|
|
$this->attributes['responsive']['details']['type'] = $value; |
108
|
|
|
|
109
|
|
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Set responsive orthogonal option value. |
114
|
|
|
* |
115
|
|
|
* @param mixed $value |
116
|
|
|
* @return $this |
117
|
|
|
* @see https://datatables.net/reference/option/responsive.orthogonal |
118
|
|
|
*/ |
119
|
|
|
public function responsiveOrthogonal($value) |
120
|
|
|
{ |
121
|
|
|
$this->attributes['responsive']['orthogonal'] = $value; |
122
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
} |
126
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: