Merge pull request #22558 from eileenmcnaughton/coleman
[civicrm-core.git] / CRM / Contribute / DAO / Widget.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Contribute/Widget.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4148353263bb1ae6e21aff61b94cc701)
10 */
11
12 /**
13 * Database access object for the Widget entity.
14 */
15 class CRM_Contribute_DAO_Widget extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.0';
18 const COMPONENT = 'CiviContribute';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_contribution_widget';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = TRUE;
33
34 /**
35 * Contribution ID
36 *
37 * @var int|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
40 */
41 public $id;
42
43 /**
44 * The Contribution Page which triggered this contribution
45 *
46 * @var int|string|null
47 * (SQL type: int unsigned)
48 * Note that values will be retrieved from the database as a string.
49 */
50 public $contribution_page_id;
51
52 /**
53 * Is this property active?
54 *
55 * @var bool|string|null
56 * (SQL type: tinyint)
57 * Note that values will be retrieved from the database as a string.
58 */
59 public $is_active;
60
61 /**
62 * Widget title.
63 *
64 * @var string|null
65 * (SQL type: varchar(255))
66 * Note that values will be retrieved from the database as a string.
67 */
68 public $title;
69
70 /**
71 * URL to Widget logo
72 *
73 * @var string|null
74 * (SQL type: varchar(255))
75 * Note that values will be retrieved from the database as a string.
76 */
77 public $url_logo;
78
79 /**
80 * Button title.
81 *
82 * @var string|null
83 * (SQL type: varchar(255))
84 * Note that values will be retrieved from the database as a string.
85 */
86 public $button_title;
87
88 /**
89 * About description.
90 *
91 * @var string|null
92 * (SQL type: text)
93 * Note that values will be retrieved from the database as a string.
94 */
95 public $about;
96
97 /**
98 * URL to Homepage.
99 *
100 * @var string|null
101 * (SQL type: varchar(255))
102 * Note that values will be retrieved from the database as a string.
103 */
104 public $url_homepage;
105
106 /**
107 * @var string|null
108 * (SQL type: varchar(10))
109 * Note that values will be retrieved from the database as a string.
110 */
111 public $color_title;
112
113 /**
114 * @var string|null
115 * (SQL type: varchar(10))
116 * Note that values will be retrieved from the database as a string.
117 */
118 public $color_button;
119
120 /**
121 * @var string|null
122 * (SQL type: varchar(10))
123 * Note that values will be retrieved from the database as a string.
124 */
125 public $color_bar;
126
127 /**
128 * @var string|null
129 * (SQL type: varchar(10))
130 * Note that values will be retrieved from the database as a string.
131 */
132 public $color_main_text;
133
134 /**
135 * @var string|null
136 * (SQL type: varchar(10))
137 * Note that values will be retrieved from the database as a string.
138 */
139 public $color_main;
140
141 /**
142 * @var string|null
143 * (SQL type: varchar(10))
144 * Note that values will be retrieved from the database as a string.
145 */
146 public $color_main_bg;
147
148 /**
149 * @var string|null
150 * (SQL type: varchar(10))
151 * Note that values will be retrieved from the database as a string.
152 */
153 public $color_bg;
154
155 /**
156 * @var string|null
157 * (SQL type: varchar(10))
158 * Note that values will be retrieved from the database as a string.
159 */
160 public $color_about_link;
161
162 /**
163 * @var string|null
164 * (SQL type: varchar(10))
165 * Note that values will be retrieved from the database as a string.
166 */
167 public $color_homepage_link;
168
169 /**
170 * Class constructor.
171 */
172 public function __construct() {
173 $this->__table = 'civicrm_contribution_widget';
174 parent::__construct();
175 }
176
177 /**
178 * Returns localized title of this entity.
179 *
180 * @param bool $plural
181 * Whether to return the plural version of the title.
182 */
183 public static function getEntityTitle($plural = FALSE) {
184 return $plural ? ts('Widgets') : ts('Widget');
185 }
186
187 /**
188 * Returns foreign keys and entity references.
189 *
190 * @return array
191 * [CRM_Core_Reference_Interface]
192 */
193 public static function getReferenceColumns() {
194 if (!isset(Civi::$statics[__CLASS__]['links'])) {
195 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
196 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id');
197 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
198 }
199 return Civi::$statics[__CLASS__]['links'];
200 }
201
202 /**
203 * Returns all the column names of this table
204 *
205 * @return array
206 */
207 public static function &fields() {
208 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
209 Civi::$statics[__CLASS__]['fields'] = [
210 'id' => [
211 'name' => 'id',
212 'type' => CRM_Utils_Type::T_INT,
213 'title' => ts('Widget ID'),
214 'description' => ts('Contribution ID'),
215 'required' => TRUE,
216 'where' => 'civicrm_contribution_widget.id',
217 'table_name' => 'civicrm_contribution_widget',
218 'entity' => 'Widget',
219 'bao' => 'CRM_Contribute_BAO_Widget',
220 'localizable' => 0,
221 'html' => [
222 'type' => 'Number',
223 ],
224 'readonly' => TRUE,
225 'add' => '2.0',
226 ],
227 'contribution_page_id' => [
228 'name' => 'contribution_page_id',
229 'type' => CRM_Utils_Type::T_INT,
230 'title' => ts('Contribution Page ID'),
231 'description' => ts('The Contribution Page which triggered this contribution'),
232 'where' => 'civicrm_contribution_widget.contribution_page_id',
233 'table_name' => 'civicrm_contribution_widget',
234 'entity' => 'Widget',
235 'bao' => 'CRM_Contribute_BAO_Widget',
236 'localizable' => 0,
237 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
238 'html' => [
239 'label' => ts("Contribution Page"),
240 ],
241 'add' => '1.5',
242 ],
243 'is_active' => [
244 'name' => 'is_active',
245 'type' => CRM_Utils_Type::T_BOOLEAN,
246 'title' => ts('Enabled?'),
247 'description' => ts('Is this property active?'),
248 'where' => 'civicrm_contribution_widget.is_active',
249 'table_name' => 'civicrm_contribution_widget',
250 'entity' => 'Widget',
251 'bao' => 'CRM_Contribute_BAO_Widget',
252 'localizable' => 0,
253 'add' => '2.0',
254 ],
255 'title' => [
256 'name' => 'title',
257 'type' => CRM_Utils_Type::T_STRING,
258 'title' => ts('Widget Title'),
259 'description' => ts('Widget title.'),
260 'maxlength' => 255,
261 'size' => CRM_Utils_Type::HUGE,
262 'where' => 'civicrm_contribution_widget.title',
263 'table_name' => 'civicrm_contribution_widget',
264 'entity' => 'Widget',
265 'bao' => 'CRM_Contribute_BAO_Widget',
266 'localizable' => 0,
267 'add' => '2.0',
268 ],
269 'url_logo' => [
270 'name' => 'url_logo',
271 'type' => CRM_Utils_Type::T_STRING,
272 'title' => ts('Widget Image Url'),
273 'description' => ts('URL to Widget logo'),
274 'maxlength' => 255,
275 'size' => CRM_Utils_Type::HUGE,
276 'where' => 'civicrm_contribution_widget.url_logo',
277 'table_name' => 'civicrm_contribution_widget',
278 'entity' => 'Widget',
279 'bao' => 'CRM_Contribute_BAO_Widget',
280 'localizable' => 0,
281 'add' => '2.0',
282 ],
283 'button_title' => [
284 'name' => 'button_title',
285 'type' => CRM_Utils_Type::T_STRING,
286 'title' => ts('Button Title'),
287 'description' => ts('Button title.'),
288 'maxlength' => 255,
289 'size' => CRM_Utils_Type::HUGE,
290 'where' => 'civicrm_contribution_widget.button_title',
291 'table_name' => 'civicrm_contribution_widget',
292 'entity' => 'Widget',
293 'bao' => 'CRM_Contribute_BAO_Widget',
294 'localizable' => 0,
295 'add' => '2.0',
296 ],
297 'about' => [
298 'name' => 'about',
299 'type' => CRM_Utils_Type::T_TEXT,
300 'title' => ts('Description'),
301 'description' => ts('About description.'),
302 'where' => 'civicrm_contribution_widget.about',
303 'table_name' => 'civicrm_contribution_widget',
304 'entity' => 'Widget',
305 'bao' => 'CRM_Contribute_BAO_Widget',
306 'localizable' => 0,
307 'add' => '2.0',
308 ],
309 'url_homepage' => [
310 'name' => 'url_homepage',
311 'type' => CRM_Utils_Type::T_STRING,
312 'title' => ts('Homepage Url'),
313 'description' => ts('URL to Homepage.'),
314 'maxlength' => 255,
315 'size' => CRM_Utils_Type::HUGE,
316 'where' => 'civicrm_contribution_widget.url_homepage',
317 'table_name' => 'civicrm_contribution_widget',
318 'entity' => 'Widget',
319 'bao' => 'CRM_Contribute_BAO_Widget',
320 'localizable' => 0,
321 'add' => '2.0',
322 ],
323 'color_title' => [
324 'name' => 'color_title',
325 'type' => CRM_Utils_Type::T_STRING,
326 'title' => ts('Title Color'),
327 'maxlength' => 10,
328 'size' => CRM_Utils_Type::TWELVE,
329 'where' => 'civicrm_contribution_widget.color_title',
330 'table_name' => 'civicrm_contribution_widget',
331 'entity' => 'Widget',
332 'bao' => 'CRM_Contribute_BAO_Widget',
333 'localizable' => 0,
334 'add' => '2.0',
335 ],
336 'color_button' => [
337 'name' => 'color_button',
338 'type' => CRM_Utils_Type::T_STRING,
339 'title' => ts('Button Color'),
340 'maxlength' => 10,
341 'size' => CRM_Utils_Type::TWELVE,
342 'where' => 'civicrm_contribution_widget.color_button',
343 'table_name' => 'civicrm_contribution_widget',
344 'entity' => 'Widget',
345 'bao' => 'CRM_Contribute_BAO_Widget',
346 'localizable' => 0,
347 'add' => '2.0',
348 ],
349 'color_bar' => [
350 'name' => 'color_bar',
351 'type' => CRM_Utils_Type::T_STRING,
352 'title' => ts('Bar Color'),
353 'maxlength' => 10,
354 'size' => CRM_Utils_Type::TWELVE,
355 'where' => 'civicrm_contribution_widget.color_bar',
356 'table_name' => 'civicrm_contribution_widget',
357 'entity' => 'Widget',
358 'bao' => 'CRM_Contribute_BAO_Widget',
359 'localizable' => 0,
360 'add' => '2.0',
361 ],
362 'color_main_text' => [
363 'name' => 'color_main_text',
364 'type' => CRM_Utils_Type::T_STRING,
365 'title' => ts('Main Text Color'),
366 'maxlength' => 10,
367 'size' => CRM_Utils_Type::TWELVE,
368 'where' => 'civicrm_contribution_widget.color_main_text',
369 'table_name' => 'civicrm_contribution_widget',
370 'entity' => 'Widget',
371 'bao' => 'CRM_Contribute_BAO_Widget',
372 'localizable' => 0,
373 'add' => '2.0',
374 ],
375 'color_main' => [
376 'name' => 'color_main',
377 'type' => CRM_Utils_Type::T_STRING,
378 'title' => ts('Main Color'),
379 'maxlength' => 10,
380 'size' => CRM_Utils_Type::TWELVE,
381 'where' => 'civicrm_contribution_widget.color_main',
382 'table_name' => 'civicrm_contribution_widget',
383 'entity' => 'Widget',
384 'bao' => 'CRM_Contribute_BAO_Widget',
385 'localizable' => 0,
386 'add' => '2.0',
387 ],
388 'color_main_bg' => [
389 'name' => 'color_main_bg',
390 'type' => CRM_Utils_Type::T_STRING,
391 'title' => ts('Background Color'),
392 'maxlength' => 10,
393 'size' => CRM_Utils_Type::TWELVE,
394 'where' => 'civicrm_contribution_widget.color_main_bg',
395 'table_name' => 'civicrm_contribution_widget',
396 'entity' => 'Widget',
397 'bao' => 'CRM_Contribute_BAO_Widget',
398 'localizable' => 0,
399 'add' => '2.0',
400 ],
401 'color_bg' => [
402 'name' => 'color_bg',
403 'type' => CRM_Utils_Type::T_STRING,
404 'title' => ts('Other Background Color'),
405 'maxlength' => 10,
406 'size' => CRM_Utils_Type::TWELVE,
407 'where' => 'civicrm_contribution_widget.color_bg',
408 'table_name' => 'civicrm_contribution_widget',
409 'entity' => 'Widget',
410 'bao' => 'CRM_Contribute_BAO_Widget',
411 'localizable' => 0,
412 'add' => '2.0',
413 ],
414 'color_about_link' => [
415 'name' => 'color_about_link',
416 'type' => CRM_Utils_Type::T_STRING,
417 'title' => ts('About Link Color'),
418 'maxlength' => 10,
419 'size' => CRM_Utils_Type::TWELVE,
420 'where' => 'civicrm_contribution_widget.color_about_link',
421 'table_name' => 'civicrm_contribution_widget',
422 'entity' => 'Widget',
423 'bao' => 'CRM_Contribute_BAO_Widget',
424 'localizable' => 0,
425 'add' => '2.0',
426 ],
427 'color_homepage_link' => [
428 'name' => 'color_homepage_link',
429 'type' => CRM_Utils_Type::T_STRING,
430 'title' => ts('Homepage Link Color'),
431 'maxlength' => 10,
432 'size' => CRM_Utils_Type::TWELVE,
433 'where' => 'civicrm_contribution_widget.color_homepage_link',
434 'table_name' => 'civicrm_contribution_widget',
435 'entity' => 'Widget',
436 'bao' => 'CRM_Contribute_BAO_Widget',
437 'localizable' => 0,
438 'add' => '2.0',
439 ],
440 ];
441 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
442 }
443 return Civi::$statics[__CLASS__]['fields'];
444 }
445
446 /**
447 * Return a mapping from field-name to the corresponding key (as used in fields()).
448 *
449 * @return array
450 * Array(string $name => string $uniqueName).
451 */
452 public static function &fieldKeys() {
453 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
454 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
455 }
456 return Civi::$statics[__CLASS__]['fieldKeys'];
457 }
458
459 /**
460 * Returns the names of this table
461 *
462 * @return string
463 */
464 public static function getTableName() {
465 return self::$_tableName;
466 }
467
468 /**
469 * Returns if this table needs to be logged
470 *
471 * @return bool
472 */
473 public function getLog() {
474 return self::$_log;
475 }
476
477 /**
478 * Returns the list of fields that can be imported
479 *
480 * @param bool $prefix
481 *
482 * @return array
483 */
484 public static function &import($prefix = FALSE) {
485 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_widget', $prefix, []);
486 return $r;
487 }
488
489 /**
490 * Returns the list of fields that can be exported
491 *
492 * @param bool $prefix
493 *
494 * @return array
495 */
496 public static function &export($prefix = FALSE) {
497 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_widget', $prefix, []);
498 return $r;
499 }
500
501 /**
502 * Returns the list of indices
503 *
504 * @param bool $localize
505 *
506 * @return array
507 */
508 public static function indices($localize = TRUE) {
509 $indices = [];
510 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
511 }
512
513 }