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