Merge pull request #20600 from ixiam/dev#SettingsTraitCheckboxes
[civicrm-core.git] / CRM / Core / DAO / Menu.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/Menu.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:43fa7e0ff85619af0065d2802de6f8f4)
10 */
11
12 /**
13 * Database access object for the Menu entity.
14 */
15 class CRM_Core_DAO_Menu extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_menu';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Which Domain is this menu item for
40 *
41 * @var int
42 */
43 public $domain_id;
44
45 /**
46 * Path Name
47 *
48 * @var string
49 */
50 public $path;
51
52 /**
53 * Arguments to pass to the url
54 *
55 * @var text
56 */
57 public $path_arguments;
58
59 /**
60 * @var string
61 */
62 public $title;
63
64 /**
65 * Function to call to check access permissions
66 *
67 * @var string
68 */
69 public $access_callback;
70
71 /**
72 * Arguments to pass to access callback
73 *
74 * @var text
75 */
76 public $access_arguments;
77
78 /**
79 * function to call for this url
80 *
81 * @var string
82 */
83 public $page_callback;
84
85 /**
86 * Arguments to pass to page callback
87 *
88 * @var text
89 */
90 public $page_arguments;
91
92 /**
93 * Breadcrumb for the path.
94 *
95 * @var text
96 */
97 public $breadcrumb;
98
99 /**
100 * Url where a page should redirected to, if next url not known.
101 *
102 * @var string
103 */
104 public $return_url;
105
106 /**
107 * Arguments to pass to return_url
108 *
109 * @var string
110 */
111 public $return_url_args;
112
113 /**
114 * Component that this menu item belongs to
115 *
116 * @var int
117 */
118 public $component_id;
119
120 /**
121 * Is this menu item active?
122 *
123 * @var bool
124 */
125 public $is_active;
126
127 /**
128 * Is this menu accessible to the public?
129 *
130 * @var bool
131 */
132 public $is_public;
133
134 /**
135 * Is this menu exposed to the navigation system?
136 *
137 * @var bool
138 */
139 public $is_exposed;
140
141 /**
142 * Should this menu be exposed via SSL if enabled?
143 *
144 * @var bool
145 */
146 public $is_ssl;
147
148 /**
149 * Ordering of the menu items in various blocks.
150 *
151 * @var int
152 */
153 public $weight;
154
155 /**
156 * Drupal menu type.
157 *
158 * @var int
159 */
160 public $type;
161
162 /**
163 * CiviCRM menu type.
164 *
165 * @var int
166 */
167 public $page_type;
168
169 /**
170 * skip this url being exposed to breadcrumb
171 *
172 * @var bool
173 */
174 public $skipBreadcrumb;
175
176 /**
177 * All other menu metadata not stored in other fields
178 *
179 * @var text
180 */
181 public $module_data;
182
183 /**
184 * Class constructor.
185 */
186 public function __construct() {
187 $this->__table = 'civicrm_menu';
188 parent::__construct();
189 }
190
191 /**
192 * Returns localized title of this entity.
193 *
194 * @param bool $plural
195 * Whether to return the plural version of the title.
196 */
197 public static function getEntityTitle($plural = FALSE) {
198 return $plural ? ts('Menus') : ts('Menu');
199 }
200
201 /**
202 * Returns foreign keys and entity references.
203 *
204 * @return array
205 * [CRM_Core_Reference_Interface]
206 */
207 public static function getReferenceColumns() {
208 if (!isset(Civi::$statics[__CLASS__]['links'])) {
209 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
210 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
211 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id');
212 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
213 }
214 return Civi::$statics[__CLASS__]['links'];
215 }
216
217 /**
218 * Returns all the column names of this table
219 *
220 * @return array
221 */
222 public static function &fields() {
223 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
224 Civi::$statics[__CLASS__]['fields'] = [
225 'id' => [
226 'name' => 'id',
227 'type' => CRM_Utils_Type::T_INT,
228 'title' => ts('Menu ID'),
229 'required' => TRUE,
230 'where' => 'civicrm_menu.id',
231 'table_name' => 'civicrm_menu',
232 'entity' => 'Menu',
233 'bao' => 'CRM_Core_DAO_Menu',
234 'localizable' => 0,
235 'html' => [
236 'type' => 'Number',
237 ],
238 'readonly' => TRUE,
239 'add' => '2.1',
240 ],
241 'domain_id' => [
242 'name' => 'domain_id',
243 'type' => CRM_Utils_Type::T_INT,
244 'title' => ts('Domain ID'),
245 'description' => ts('Which Domain is this menu item for'),
246 'required' => TRUE,
247 'where' => 'civicrm_menu.domain_id',
248 'table_name' => 'civicrm_menu',
249 'entity' => 'Menu',
250 'bao' => 'CRM_Core_DAO_Menu',
251 'localizable' => 0,
252 'FKClassName' => 'CRM_Core_DAO_Domain',
253 'html' => [
254 'label' => ts("Domain"),
255 ],
256 'pseudoconstant' => [
257 'table' => 'civicrm_domain',
258 'keyColumn' => 'id',
259 'labelColumn' => 'name',
260 ],
261 'add' => '3.0',
262 ],
263 'path' => [
264 'name' => 'path',
265 'type' => CRM_Utils_Type::T_STRING,
266 'title' => ts('Path'),
267 'description' => ts('Path Name'),
268 'maxlength' => 255,
269 'size' => CRM_Utils_Type::HUGE,
270 'where' => 'civicrm_menu.path',
271 'table_name' => 'civicrm_menu',
272 'entity' => 'Menu',
273 'bao' => 'CRM_Core_DAO_Menu',
274 'localizable' => 0,
275 'add' => '2.1',
276 ],
277 'path_arguments' => [
278 'name' => 'path_arguments',
279 'type' => CRM_Utils_Type::T_TEXT,
280 'title' => ts('Arguments'),
281 'description' => ts('Arguments to pass to the url'),
282 'where' => 'civicrm_menu.path_arguments',
283 'table_name' => 'civicrm_menu',
284 'entity' => 'Menu',
285 'bao' => 'CRM_Core_DAO_Menu',
286 'localizable' => 0,
287 'add' => '2.1',
288 ],
289 'title' => [
290 'name' => 'title',
291 'type' => CRM_Utils_Type::T_STRING,
292 'title' => ts('Menu Title'),
293 'maxlength' => 255,
294 'size' => CRM_Utils_Type::HUGE,
295 'where' => 'civicrm_menu.title',
296 'table_name' => 'civicrm_menu',
297 'entity' => 'Menu',
298 'bao' => 'CRM_Core_DAO_Menu',
299 'localizable' => 0,
300 'add' => '2.1',
301 ],
302 'access_callback' => [
303 'name' => 'access_callback',
304 'type' => CRM_Utils_Type::T_STRING,
305 'title' => ts('Access Callback'),
306 'description' => ts('Function to call to check access permissions'),
307 'maxlength' => 255,
308 'size' => CRM_Utils_Type::HUGE,
309 'where' => 'civicrm_menu.access_callback',
310 'table_name' => 'civicrm_menu',
311 'entity' => 'Menu',
312 'bao' => 'CRM_Core_DAO_Menu',
313 'localizable' => 0,
314 'add' => '2.1',
315 ],
316 'access_arguments' => [
317 'name' => 'access_arguments',
318 'type' => CRM_Utils_Type::T_TEXT,
319 'title' => ts('Access Arguments'),
320 'description' => ts('Arguments to pass to access callback'),
321 'where' => 'civicrm_menu.access_arguments',
322 'table_name' => 'civicrm_menu',
323 'entity' => 'Menu',
324 'bao' => 'CRM_Core_DAO_Menu',
325 'localizable' => 0,
326 'add' => '2.1',
327 ],
328 'page_callback' => [
329 'name' => 'page_callback',
330 'type' => CRM_Utils_Type::T_STRING,
331 'title' => ts('Page Callback'),
332 'description' => ts('function to call for this url'),
333 'maxlength' => 255,
334 'size' => CRM_Utils_Type::HUGE,
335 'where' => 'civicrm_menu.page_callback',
336 'table_name' => 'civicrm_menu',
337 'entity' => 'Menu',
338 'bao' => 'CRM_Core_DAO_Menu',
339 'localizable' => 0,
340 'add' => '2.1',
341 ],
342 'page_arguments' => [
343 'name' => 'page_arguments',
344 'type' => CRM_Utils_Type::T_TEXT,
345 'title' => ts('Page Arguments'),
346 'description' => ts('Arguments to pass to page callback'),
347 'where' => 'civicrm_menu.page_arguments',
348 'table_name' => 'civicrm_menu',
349 'entity' => 'Menu',
350 'bao' => 'CRM_Core_DAO_Menu',
351 'localizable' => 0,
352 'add' => '2.1',
353 ],
354 'breadcrumb' => [
355 'name' => 'breadcrumb',
356 'type' => CRM_Utils_Type::T_TEXT,
357 'title' => ts('Breadcrumb'),
358 'description' => ts('Breadcrumb for the path.'),
359 'where' => 'civicrm_menu.breadcrumb',
360 'table_name' => 'civicrm_menu',
361 'entity' => 'Menu',
362 'bao' => 'CRM_Core_DAO_Menu',
363 'localizable' => 0,
364 'add' => '2.1',
365 ],
366 'return_url' => [
367 'name' => 'return_url',
368 'type' => CRM_Utils_Type::T_STRING,
369 'title' => ts('Return Url'),
370 'description' => ts('Url where a page should redirected to, if next url not known.'),
371 'maxlength' => 255,
372 'size' => CRM_Utils_Type::HUGE,
373 'where' => 'civicrm_menu.return_url',
374 'table_name' => 'civicrm_menu',
375 'entity' => 'Menu',
376 'bao' => 'CRM_Core_DAO_Menu',
377 'localizable' => 0,
378 'html' => [
379 'label' => ts("Return URL"),
380 ],
381 'add' => '2.1',
382 ],
383 'return_url_args' => [
384 'name' => 'return_url_args',
385 'type' => CRM_Utils_Type::T_STRING,
386 'title' => ts('Return Url Args'),
387 'description' => ts('Arguments to pass to return_url'),
388 'maxlength' => 255,
389 'size' => CRM_Utils_Type::HUGE,
390 'where' => 'civicrm_menu.return_url_args',
391 'table_name' => 'civicrm_menu',
392 'entity' => 'Menu',
393 'bao' => 'CRM_Core_DAO_Menu',
394 'localizable' => 0,
395 'html' => [
396 'label' => ts("Return URL Arguments"),
397 ],
398 'add' => '2.1',
399 ],
400 'component_id' => [
401 'name' => 'component_id',
402 'type' => CRM_Utils_Type::T_INT,
403 'title' => ts('Component ID'),
404 'description' => ts('Component that this menu item belongs to'),
405 'where' => 'civicrm_menu.component_id',
406 'table_name' => 'civicrm_menu',
407 'entity' => 'Menu',
408 'bao' => 'CRM_Core_DAO_Menu',
409 'localizable' => 0,
410 'FKClassName' => 'CRM_Core_DAO_Component',
411 'html' => [
412 'type' => 'Select',
413 'label' => ts("Component"),
414 ],
415 'pseudoconstant' => [
416 'table' => 'civicrm_component',
417 'keyColumn' => 'id',
418 'labelColumn' => 'name',
419 ],
420 'add' => '2.1',
421 ],
422 'is_active' => [
423 'name' => 'is_active',
424 'type' => CRM_Utils_Type::T_BOOLEAN,
425 'title' => ts('Enabled?'),
426 'description' => ts('Is this menu item active?'),
427 'where' => 'civicrm_menu.is_active',
428 'table_name' => 'civicrm_menu',
429 'entity' => 'Menu',
430 'bao' => 'CRM_Core_DAO_Menu',
431 'localizable' => 0,
432 'add' => '2.1',
433 ],
434 'is_public' => [
435 'name' => 'is_public',
436 'type' => CRM_Utils_Type::T_BOOLEAN,
437 'title' => ts('Public?'),
438 'description' => ts('Is this menu accessible to the public?'),
439 'where' => 'civicrm_menu.is_public',
440 'table_name' => 'civicrm_menu',
441 'entity' => 'Menu',
442 'bao' => 'CRM_Core_DAO_Menu',
443 'localizable' => 0,
444 'add' => '2.1',
445 ],
446 'is_exposed' => [
447 'name' => 'is_exposed',
448 'type' => CRM_Utils_Type::T_BOOLEAN,
449 'title' => ts('Exposed?'),
450 'description' => ts('Is this menu exposed to the navigation system?'),
451 'where' => 'civicrm_menu.is_exposed',
452 'table_name' => 'civicrm_menu',
453 'entity' => 'Menu',
454 'bao' => 'CRM_Core_DAO_Menu',
455 'localizable' => 0,
456 'add' => '2.1',
457 ],
458 'is_ssl' => [
459 'name' => 'is_ssl',
460 'type' => CRM_Utils_Type::T_BOOLEAN,
461 'title' => ts('Use SSL?'),
462 'description' => ts('Should this menu be exposed via SSL if enabled?'),
463 'where' => 'civicrm_menu.is_ssl',
464 'table_name' => 'civicrm_menu',
465 'entity' => 'Menu',
466 'bao' => 'CRM_Core_DAO_Menu',
467 'localizable' => 0,
468 'add' => '2.1',
469 ],
470 'weight' => [
471 'name' => 'weight',
472 'type' => CRM_Utils_Type::T_INT,
473 'title' => ts('Order'),
474 'description' => ts('Ordering of the menu items in various blocks.'),
475 'required' => TRUE,
476 'where' => 'civicrm_menu.weight',
477 'default' => '1',
478 'table_name' => 'civicrm_menu',
479 'entity' => 'Menu',
480 'bao' => 'CRM_Core_DAO_Menu',
481 'localizable' => 0,
482 'add' => '2.1',
483 ],
484 'type' => [
485 'name' => 'type',
486 'type' => CRM_Utils_Type::T_INT,
487 'title' => ts('Type'),
488 'description' => ts('Drupal menu type.'),
489 'required' => TRUE,
490 'where' => 'civicrm_menu.type',
491 'default' => '1',
492 'table_name' => 'civicrm_menu',
493 'entity' => 'Menu',
494 'bao' => 'CRM_Core_DAO_Menu',
495 'localizable' => 0,
496 'add' => '2.1',
497 ],
498 'page_type' => [
499 'name' => 'page_type',
500 'type' => CRM_Utils_Type::T_INT,
501 'title' => ts('Page Type'),
502 'description' => ts('CiviCRM menu type.'),
503 'required' => TRUE,
504 'where' => 'civicrm_menu.page_type',
505 'default' => '1',
506 'table_name' => 'civicrm_menu',
507 'entity' => 'Menu',
508 'bao' => 'CRM_Core_DAO_Menu',
509 'localizable' => 0,
510 'add' => '2.1',
511 ],
512 'skipBreadcrumb' => [
513 'name' => 'skipBreadcrumb',
514 'type' => CRM_Utils_Type::T_BOOLEAN,
515 'title' => ts('Hide Breadcrumb?'),
516 'description' => ts('skip this url being exposed to breadcrumb'),
517 'where' => 'civicrm_menu.skipBreadcrumb',
518 'table_name' => 'civicrm_menu',
519 'entity' => 'Menu',
520 'bao' => 'CRM_Core_DAO_Menu',
521 'localizable' => 0,
522 'add' => '2.2',
523 ],
524 'module_data' => [
525 'name' => 'module_data',
526 'type' => CRM_Utils_Type::T_TEXT,
527 'title' => ts('Other menu data'),
528 'description' => ts('All other menu metadata not stored in other fields'),
529 'where' => 'civicrm_menu.module_data',
530 'table_name' => 'civicrm_menu',
531 'entity' => 'Menu',
532 'bao' => 'CRM_Core_DAO_Menu',
533 'localizable' => 0,
534 'add' => '4.7',
535 ],
536 ];
537 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
538 }
539 return Civi::$statics[__CLASS__]['fields'];
540 }
541
542 /**
543 * Return a mapping from field-name to the corresponding key (as used in fields()).
544 *
545 * @return array
546 * Array(string $name => string $uniqueName).
547 */
548 public static function &fieldKeys() {
549 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
550 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
551 }
552 return Civi::$statics[__CLASS__]['fieldKeys'];
553 }
554
555 /**
556 * Returns the names of this table
557 *
558 * @return string
559 */
560 public static function getTableName() {
561 return self::$_tableName;
562 }
563
564 /**
565 * Returns if this table needs to be logged
566 *
567 * @return bool
568 */
569 public function getLog() {
570 return self::$_log;
571 }
572
573 /**
574 * Returns the list of fields that can be imported
575 *
576 * @param bool $prefix
577 *
578 * @return array
579 */
580 public static function &import($prefix = FALSE) {
581 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'menu', $prefix, []);
582 return $r;
583 }
584
585 /**
586 * Returns the list of fields that can be exported
587 *
588 * @param bool $prefix
589 *
590 * @return array
591 */
592 public static function &export($prefix = FALSE) {
593 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'menu', $prefix, []);
594 return $r;
595 }
596
597 /**
598 * Returns the list of indices
599 *
600 * @param bool $localize
601 *
602 * @return array
603 */
604 public static function indices($localize = TRUE) {
605 $indices = [
606 'UI_path_domain_id' => [
607 'name' => 'UI_path_domain_id',
608 'field' => [
609 0 => 'path',
610 1 => 'domain_id',
611 ],
612 'localizable' => FALSE,
613 'unique' => TRUE,
614 'sig' => 'civicrm_menu::1::path::domain_id',
615 ],
616 ];
617 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
618 }
619
620 }