1 | <?php |
||
13 | class GravityView_Entry_List { |
||
14 | |||
15 | /** |
||
16 | * @var array |
||
17 | */ |
||
18 | private $entries = array(); |
||
19 | |||
20 | /** |
||
21 | * @var int |
||
22 | */ |
||
23 | private $post_id = 0; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | private $form = array(); |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $link_format = ''; |
||
34 | |||
35 | /** |
||
36 | * HTML or text to display after the link to the entry |
||
37 | * @var string |
||
38 | */ |
||
39 | private $after_link = ''; |
||
40 | |||
41 | /** |
||
42 | * The message when there are no entries to display |
||
43 | * @var string |
||
44 | */ |
||
45 | private $empty_message = ''; |
||
46 | |||
47 | /** |
||
48 | * Whether to skip the entry currently being displayed, if any. |
||
49 | * @var bool |
||
50 | */ |
||
51 | private $skip_current_entry = true; |
||
52 | |||
53 | /** |
||
54 | * Optional. Set the context for the output to allow for easier filtering output. |
||
55 | * @var string |
||
56 | */ |
||
57 | private $context = ''; |
||
58 | |||
59 | /** |
||
60 | * HTML tag to wrap output inside |
||
61 | * @var string |
||
62 | */ |
||
63 | private $wrapper_tag = 'ul'; |
||
64 | |||
65 | /** |
||
66 | * HTML tag to wrap each entry inside |
||
67 | * @var string |
||
68 | */ |
||
69 | private $item_tag = 'li'; |
||
70 | |||
71 | /** |
||
72 | * The context this list is operating in. |
||
73 | * @todo Deprecate this class altogether. |
||
74 | * @since 2.0 |
||
75 | * @var \GV\Template_Context |
||
76 | */ |
||
77 | public $template_context; |
||
78 | |||
79 | /** |
||
80 | * The ID of the View connected to the entries being displayed |
||
81 | * @since 2.7.2 |
||
82 | * @var int |
||
83 | */ |
||
84 | public $view_id = 0; |
||
85 | |||
86 | /** |
||
87 | * @since 2.0 Added $template_context parameter |
||
88 | * @since 2.7.2 Added $view_id parameter |
||
89 | * |
||
90 | * @param array|GV\Entry[] $entries |
||
91 | * @param int $post_id |
||
92 | * @param array $form |
||
93 | * @param string $link_format |
||
94 | * @param string $after_link |
||
95 | * @param \GV\Template_Context $template_context The context |
||
96 | * @param int|null $view_id View to link to when displaying on a page with multiple Views |
||
97 | */ |
||
98 | 1 | function __construct( $entries = array(), $post_id = 0, $form = array(), $link_format = '', $after_link = '', $context = '', $template_context = null, $view_id = 0 ) { |
|
109 | |||
110 | /** |
||
111 | * @param int $post_id |
||
112 | */ |
||
113 | public function set_post_id( $post_id ) { |
||
116 | |||
117 | /** |
||
118 | * @param string $link_format |
||
119 | */ |
||
120 | public function set_link_format( $link_format ) { |
||
123 | |||
124 | /** |
||
125 | * @param boolean $skip_current_entry |
||
126 | */ |
||
127 | public function set_skip_current_entry( $skip_current_entry ) { |
||
130 | |||
131 | /** |
||
132 | * @param string $after_link |
||
133 | */ |
||
134 | public function set_after_link( $after_link ) { |
||
137 | |||
138 | /** |
||
139 | * Set the message when there are no entries to display |
||
140 | * @param string $empty_message |
||
141 | */ |
||
142 | public function set_empty_message( $empty_message ) { |
||
145 | |||
146 | /** |
||
147 | * Set the context in which this entry list is being displayed. |
||
148 | * @param string $context |
||
149 | */ |
||
150 | public function set_context( $context ) { |
||
153 | |||
154 | /** |
||
155 | * @param string $wrapper_tag |
||
156 | */ |
||
157 | public function set_wrapper_tag( $wrapper_tag ) { |
||
160 | |||
161 | /** |
||
162 | * |
||
163 | * @param string $item_tag |
||
164 | */ |
||
165 | public function set_item_tag( $item_tag ) { |
||
168 | |||
169 | /** |
||
170 | * Echo the output generated by get_output() |
||
171 | * |
||
172 | * @see get_output() |
||
173 | * |
||
174 | * @return string HTML output for entry list |
||
175 | */ |
||
176 | 1 | public function output() { |
|
184 | |||
185 | /** |
||
186 | * Get the HTML output |
||
187 | * |
||
188 | * @return string HTML output for entry list |
||
189 | */ |
||
190 | 1 | public function get_output() { |
|
231 | |||
232 | /** |
||
233 | * Should the current entry be skipped while showing the list of entries? |
||
234 | * |
||
235 | * @param array $entry GF Entry array |
||
236 | * @param array|int $current_entry As returned by GravityView_View::getCurrentEntry() |
||
237 | * |
||
238 | * @return bool True: Skip entry; False: don't skip entry |
||
239 | */ |
||
240 | 1 | private function skip_entry( $entry, $current_entry ) { |
|
258 | |||
259 | /** |
||
260 | * Get the output for a specific entry |
||
261 | * |
||
262 | * @param array $entry GF Entry array |
||
263 | * |
||
264 | * @since 1.7.2 |
||
265 | * |
||
266 | * @uses gravityview_get_link |
||
267 | * @uses GravityView_API::entry_link |
||
268 | * @uses GravityView_API::replace_variables |
||
269 | * |
||
270 | * @return string HTML output for the entry |
||
271 | */ |
||
272 | 1 | private function get_item_output( $entry ) { |
|
315 | |||
316 | } |
||
317 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.