Merge pull request #19093 from civicrm/5.32
[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:57fa30940edf98c8e957dd1f33df3f51)
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 'add' => '2.1',
236 ],
237 'domain_id' => [
238 'name' => 'domain_id',
239 'type' => CRM_Utils_Type::T_INT,
240 'title' => ts('Domain'),
241 'description' => ts('Which Domain is this menu item for'),
242 'required' => TRUE,
243 'where' => 'civicrm_menu.domain_id',
244 'table_name' => 'civicrm_menu',
245 'entity' => 'Menu',
246 'bao' => 'CRM_Core_DAO_Menu',
247 'localizable' => 0,
248 'FKClassName' => 'CRM_Core_DAO_Domain',
249 'pseudoconstant' => [
250 'table' => 'civicrm_domain',
251 'keyColumn' => 'id',
252 'labelColumn' => 'name',
253 ],
254 'add' => '3.0',
255 ],
256 'path' => [
257 'name' => 'path',
258 'type' => CRM_Utils_Type::T_STRING,
259 'title' => ts('Path'),
260 'description' => ts('Path Name'),
261 'maxlength' => 255,
262 'size' => CRM_Utils_Type::HUGE,
263 'where' => 'civicrm_menu.path',
264 'table_name' => 'civicrm_menu',
265 'entity' => 'Menu',
266 'bao' => 'CRM_Core_DAO_Menu',
267 'localizable' => 0,
268 'add' => '2.1',
269 ],
270 'path_arguments' => [
271 'name' => 'path_arguments',
272 'type' => CRM_Utils_Type::T_TEXT,
273 'title' => ts('Arguments'),
274 'description' => ts('Arguments to pass to the url'),
275 'where' => 'civicrm_menu.path_arguments',
276 'table_name' => 'civicrm_menu',
277 'entity' => 'Menu',
278 'bao' => 'CRM_Core_DAO_Menu',
279 'localizable' => 0,
280 'add' => '2.1',
281 ],
282 'title' => [
283 'name' => 'title',
284 'type' => CRM_Utils_Type::T_STRING,
285 'title' => ts('Menu Title'),
286 'maxlength' => 255,
287 'size' => CRM_Utils_Type::HUGE,
288 'where' => 'civicrm_menu.title',
289 'table_name' => 'civicrm_menu',
290 'entity' => 'Menu',
291 'bao' => 'CRM_Core_DAO_Menu',
292 'localizable' => 0,
293 'add' => '2.1',
294 ],
295 'access_callback' => [
296 'name' => 'access_callback',
297 'type' => CRM_Utils_Type::T_STRING,
298 'title' => ts('Access Callback'),
299 'description' => ts('Function to call to check access permissions'),
300 'maxlength' => 255,
301 'size' => CRM_Utils_Type::HUGE,
302 'where' => 'civicrm_menu.access_callback',
303 'table_name' => 'civicrm_menu',
304 'entity' => 'Menu',
305 'bao' => 'CRM_Core_DAO_Menu',
306 'localizable' => 0,
307 'add' => '2.1',
308 ],
309 'access_arguments' => [
310 'name' => 'access_arguments',
311 'type' => CRM_Utils_Type::T_TEXT,
312 'title' => ts('Access Arguments'),
313 'description' => ts('Arguments to pass to access callback'),
314 'where' => 'civicrm_menu.access_arguments',
315 'table_name' => 'civicrm_menu',
316 'entity' => 'Menu',
317 'bao' => 'CRM_Core_DAO_Menu',
318 'localizable' => 0,
319 'add' => '2.1',
320 ],
321 'page_callback' => [
322 'name' => 'page_callback',
323 'type' => CRM_Utils_Type::T_STRING,
324 'title' => ts('Page Callback'),
325 'description' => ts('function to call for this url'),
326 'maxlength' => 255,
327 'size' => CRM_Utils_Type::HUGE,
328 'where' => 'civicrm_menu.page_callback',
329 'table_name' => 'civicrm_menu',
330 'entity' => 'Menu',
331 'bao' => 'CRM_Core_DAO_Menu',
332 'localizable' => 0,
333 'add' => '2.1',
334 ],
335 'page_arguments' => [
336 'name' => 'page_arguments',
337 'type' => CRM_Utils_Type::T_TEXT,
338 'title' => ts('Page Arguments'),
339 'description' => ts('Arguments to pass to page callback'),
340 'where' => 'civicrm_menu.page_arguments',
341 'table_name' => 'civicrm_menu',
342 'entity' => 'Menu',
343 'bao' => 'CRM_Core_DAO_Menu',
344 'localizable' => 0,
345 'add' => '2.1',
346 ],
347 'breadcrumb' => [
348 'name' => 'breadcrumb',
349 'type' => CRM_Utils_Type::T_TEXT,
350 'title' => ts('Breadcrumb'),
351 'description' => ts('Breadcrumb for the path.'),
352 'where' => 'civicrm_menu.breadcrumb',
353 'table_name' => 'civicrm_menu',
354 'entity' => 'Menu',
355 'bao' => 'CRM_Core_DAO_Menu',
356 'localizable' => 0,
357 'add' => '2.1',
358 ],
359 'return_url' => [
360 'name' => 'return_url',
361 'type' => CRM_Utils_Type::T_STRING,
362 'title' => ts('Return Url'),
363 'description' => ts('Url where a page should redirected to, if next url not known.'),
364 'maxlength' => 255,
365 'size' => CRM_Utils_Type::HUGE,
366 'where' => 'civicrm_menu.return_url',
367 'table_name' => 'civicrm_menu',
368 'entity' => 'Menu',
369 'bao' => 'CRM_Core_DAO_Menu',
370 'localizable' => 0,
371 'add' => '2.1',
372 ],
373 'return_url_args' => [
374 'name' => 'return_url_args',
375 'type' => CRM_Utils_Type::T_STRING,
376 'title' => ts('Return Url Args'),
377 'description' => ts('Arguments to pass to return_url'),
378 'maxlength' => 255,
379 'size' => CRM_Utils_Type::HUGE,
380 'where' => 'civicrm_menu.return_url_args',
381 'table_name' => 'civicrm_menu',
382 'entity' => 'Menu',
383 'bao' => 'CRM_Core_DAO_Menu',
384 'localizable' => 0,
385 'add' => '2.1',
386 ],
387 'component_id' => [
388 'name' => 'component_id',
389 'type' => CRM_Utils_Type::T_INT,
390 'title' => ts('Component'),
391 'description' => ts('Component that this menu item belongs to'),
392 'where' => 'civicrm_menu.component_id',
393 'table_name' => 'civicrm_menu',
394 'entity' => 'Menu',
395 'bao' => 'CRM_Core_DAO_Menu',
396 'localizable' => 0,
397 'FKClassName' => 'CRM_Core_DAO_Component',
398 'html' => [
399 'type' => 'Select',
400 ],
401 'pseudoconstant' => [
402 'table' => 'civicrm_component',
403 'keyColumn' => 'id',
404 'labelColumn' => 'name',
405 ],
406 'add' => '2.1',
407 ],
408 'is_active' => [
409 'name' => 'is_active',
410 'type' => CRM_Utils_Type::T_BOOLEAN,
411 'title' => ts('Enabled?'),
412 'description' => ts('Is this menu item active?'),
413 'where' => 'civicrm_menu.is_active',
414 'table_name' => 'civicrm_menu',
415 'entity' => 'Menu',
416 'bao' => 'CRM_Core_DAO_Menu',
417 'localizable' => 0,
418 'add' => '2.1',
419 ],
420 'is_public' => [
421 'name' => 'is_public',
422 'type' => CRM_Utils_Type::T_BOOLEAN,
423 'title' => ts('Public?'),
424 'description' => ts('Is this menu accessible to the public?'),
425 'where' => 'civicrm_menu.is_public',
426 'table_name' => 'civicrm_menu',
427 'entity' => 'Menu',
428 'bao' => 'CRM_Core_DAO_Menu',
429 'localizable' => 0,
430 'add' => '2.1',
431 ],
432 'is_exposed' => [
433 'name' => 'is_exposed',
434 'type' => CRM_Utils_Type::T_BOOLEAN,
435 'title' => ts('Exposed?'),
436 'description' => ts('Is this menu exposed to the navigation system?'),
437 'where' => 'civicrm_menu.is_exposed',
438 'table_name' => 'civicrm_menu',
439 'entity' => 'Menu',
440 'bao' => 'CRM_Core_DAO_Menu',
441 'localizable' => 0,
442 'add' => '2.1',
443 ],
444 'is_ssl' => [
445 'name' => 'is_ssl',
446 'type' => CRM_Utils_Type::T_BOOLEAN,
447 'title' => ts('Use SSL?'),
448 'description' => ts('Should this menu be exposed via SSL if enabled?'),
449 'where' => 'civicrm_menu.is_ssl',
450 'table_name' => 'civicrm_menu',
451 'entity' => 'Menu',
452 'bao' => 'CRM_Core_DAO_Menu',
453 'localizable' => 0,
454 'add' => '2.1',
455 ],
456 'weight' => [
457 'name' => 'weight',
458 'type' => CRM_Utils_Type::T_INT,
459 'title' => ts('Order'),
460 'description' => ts('Ordering of the menu items in various blocks.'),
461 'required' => TRUE,
462 'where' => 'civicrm_menu.weight',
463 'default' => '1',
464 'table_name' => 'civicrm_menu',
465 'entity' => 'Menu',
466 'bao' => 'CRM_Core_DAO_Menu',
467 'localizable' => 0,
468 'add' => '2.1',
469 ],
470 'type' => [
471 'name' => 'type',
472 'type' => CRM_Utils_Type::T_INT,
473 'title' => ts('Type'),
474 'description' => ts('Drupal menu type.'),
475 'required' => TRUE,
476 'where' => 'civicrm_menu.type',
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 'page_type' => [
485 'name' => 'page_type',
486 'type' => CRM_Utils_Type::T_INT,
487 'title' => ts('Page Type'),
488 'description' => ts('CiviCRM menu type.'),
489 'required' => TRUE,
490 'where' => 'civicrm_menu.page_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 'skipBreadcrumb' => [
499 'name' => 'skipBreadcrumb',
500 'type' => CRM_Utils_Type::T_BOOLEAN,
501 'title' => ts('Hide Breadcrumb?'),
502 'description' => ts('skip this url being exposed to breadcrumb'),
503 'where' => 'civicrm_menu.skipBreadcrumb',
504 'table_name' => 'civicrm_menu',
505 'entity' => 'Menu',
506 'bao' => 'CRM_Core_DAO_Menu',
507 'localizable' => 0,
508 'add' => '2.2',
509 ],
510 'module_data' => [
511 'name' => 'module_data',
512 'type' => CRM_Utils_Type::T_TEXT,
513 'title' => ts('Other menu data'),
514 'description' => ts('All other menu metadata not stored in other fields'),
515 'where' => 'civicrm_menu.module_data',
516 'table_name' => 'civicrm_menu',
517 'entity' => 'Menu',
518 'bao' => 'CRM_Core_DAO_Menu',
519 'localizable' => 0,
520 'add' => '4.7',
521 ],
522 ];
523 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
524 }
525 return Civi::$statics[__CLASS__]['fields'];
526 }
527
528 /**
529 * Return a mapping from field-name to the corresponding key (as used in fields()).
530 *
531 * @return array
532 * Array(string $name => string $uniqueName).
533 */
534 public static function &fieldKeys() {
535 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
536 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
537 }
538 return Civi::$statics[__CLASS__]['fieldKeys'];
539 }
540
541 /**
542 * Returns the names of this table
543 *
544 * @return string
545 */
546 public static function getTableName() {
547 return self::$_tableName;
548 }
549
550 /**
551 * Returns if this table needs to be logged
552 *
553 * @return bool
554 */
555 public function getLog() {
556 return self::$_log;
557 }
558
559 /**
560 * Returns the list of fields that can be imported
561 *
562 * @param bool $prefix
563 *
564 * @return array
565 */
566 public static function &import($prefix = FALSE) {
567 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'menu', $prefix, []);
568 return $r;
569 }
570
571 /**
572 * Returns the list of fields that can be exported
573 *
574 * @param bool $prefix
575 *
576 * @return array
577 */
578 public static function &export($prefix = FALSE) {
579 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'menu', $prefix, []);
580 return $r;
581 }
582
583 /**
584 * Returns the list of indices
585 *
586 * @param bool $localize
587 *
588 * @return array
589 */
590 public static function indices($localize = TRUE) {
591 $indices = [
592 'UI_path_domain_id' => [
593 'name' => 'UI_path_domain_id',
594 'field' => [
595 0 => 'path',
596 1 => 'domain_id',
597 ],
598 'localizable' => FALSE,
599 'unique' => TRUE,
600 'sig' => 'civicrm_menu::1::path::domain_id',
601 ],
602 ];
603 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
604 }
605
606 }