PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
← All changes | src/Framework/ListTable/ListTable.php +52 -5 2.30.04.16.9 View file →
@@ -23,8 +23,14 @@
23 23 */
24 24 private $items = [];
25 25
26 26 /**
27 + * @since 4.0.0
28 + * @var array|object
29 + */
30 + private $data = [];
31 +
32 + /**
27 33 * @since 2.24.0
28 34 *
29 35 * @throws ColumnIdCollisionException
30 36 */
@@ -92,8 +98,11 @@
92 98 foreach ($items as $model) {
93 99 $row = [];
94 100
95 101 foreach ($columns as $column) {
102 + if ($column->isUsingListTableData()) {
103 + $column->setListTableData($this->getData());
104 + }
96 105 $row[$column::getId()] = $this->safelyGetCellValue($column, $model, $locale);;
97 106 }
98 107
99 108 $data[] = $row;
@@ -112,8 +121,32 @@
112 121 return $this->items;
113 122 }
114 123
115 124 /**
125 + * @since 4.0.0
126 + *
127 + * @param array|object $data
128 + *
129 + * @return ListTable
130 + */
131 + public function setData($data): ListTable
132 + {
133 + $this->data = $data;
134 +
135 + return $this;
136 + }
137 +
138 + /**
139 + * @since 4.0.0
140 + *
141 + * @return array|object
142 + */
143 + public function getData()
144 + {
145 + return $this->data;
146 + }
147 +
148 + /**
116 149 * Safely retrieves the cell value for a column. If an exception is thrown, it will be logged and the cell value
117 150 * will be a human-readable error message. This is to prevent fatal errors from breaking the entire table.
118 151 *
119 152 * @since 2.24.1
@@ -122,9 +155,23 @@
122 155 */
123 156 private function safelyGetCellValue(ModelColumn $column, Model $model, string $locale)
124 157 {
125 158 try {
126 - $cellValue = $column->getCellValue($model, $locale);
159 + /**
160 + * @since 3.16.0
161 + */
162 + do_action("givewp_list_table_cell_value_{$column::getId()}_before", $column, $model, $locale);
163 +
164 + /**
165 + * @since 3.16.0
166 + */
167 + $cellValue = apply_filters(
168 + "givewp_list_table_cell_value_{$column::getId()}",
169 + $column->getCellValue($model, $locale),
170 + $column,
171 + $model,
172 + $locale
173 + );
127 174 } catch (Exception $exception) {
128 175 Log::error(
129 176 sprintf(
130 177 'Error while rendering column "%s" for table "%s".',
@@ -138,14 +185,14 @@
138 185 'exception' => $exception->getMessage(),
139 186 ]
140 187 );
141 188
142 - $cellValue = __(
143 - sprintf(
189 + $cellValue = sprintf(
190 + __(
144 191 'Something went wrong, more in detail in <a href="%s">logs</a>',
145 - admin_url('edit.php?post_type=give_forms&page=give-tools&tab=logs')
192 + 'give'
146 193 ),
147 - 'give'
194 + admin_url('edit.php?post_type=give_forms&page=give-tools&tab=logs')
148 195 );
149 196 }
150 197
151 198 return $cellValue;