Merge pull request #17078 from herbdool/ui-18
[civicrm-core.git] / xml / templates / schema_structure.tpl
CommitLineData
6a488035 1<?php
6a488035 2/*
6b7eb9df
TO
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
3eb2aab1 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035 16 *
d5864876
ARW
17 * Generated from {$smarty.template}
18 * {$generated}
6a488035 19 */
3eb2aab1 20class CRM_Core_I18n_SchemaStructure {ldelim}
f2ac86d1 21
3eb2aab1
TO
22 /**
23 * Get translatable columns.
24 *
25 * @return array
26 * A table-indexed array of translatable columns.
27 */
28 public static function &columns() {ldelim}
29 static $result = NULL;
30 if (!$result) {ldelim}
31 $result = [
32{foreach from=$columns key=table item=types}
33 '{$table}' => [
34{foreach from=$types key=column item=type}
35 '{$column}' => "{$type}",
36{/foreach}{* /foreach from=$types item=type *}
37 ],
38{/foreach}{* /foreach from=$columns item=types *}
39 ];
6a488035 40 {rdelim}
3eb2aab1
TO
41 return $result;
42 {rdelim}
f2ac86d1 43
3eb2aab1
TO
44 /**
45 * Get a table indexed array of the indices for translatable fields.
46 *
47 * @return array
48 * Indices for translatable fields.
49 */
50 public static function &indices() {ldelim}
51 static $result = NULL;
52 if (!$result) {ldelim}
53 $result = [
54{foreach from=$indices key=table item=tableIndices}
55 '{$table}' => [
56{foreach from=$tableIndices key=name item=info}
57 '{$name}' => [
58 'name' => '{$info.name}',
59 'field' => [
60{foreach from=$info.field item=field}
61 '{$field}',
62{/foreach}{* foreach from=$info.field item=field *}
63 ],
64 {if $info.unique}'unique' => 1,{/if}
65
66 ],
67{/foreach}{* /foreach from=$tableIndices item=info *}
68 ],
69{/foreach}{* /foreach from=$indices item=tableIndices *}
70 ];
6a488035 71 {rdelim}
3eb2aab1
TO
72 return $result;
73 {rdelim}
f2ac86d1 74
3eb2aab1
TO
75 /**
76 * Get tables with translatable fields.
77 *
78 * @return array
79 * Array of names of tables with fields that can be translated.
80 */
81 public static function &tables() {ldelim}
82 static $result = NULL;
83 if (!$result) {ldelim}
84 $result = array_keys(self::columns());
6a488035 85 {rdelim}
3eb2aab1
TO
86 return $result;
87 {rdelim}
f2ac86d1 88
3eb2aab1
TO
89 /**
90 * Get a list of widgets for editing translatable fields.
91 *
92 * @return array
93 * Array of the widgets for editing translatable fields.
94 */
95 public static function &widgets() {ldelim}
96 static $result = NULL;
97 if (!$result) {ldelim}
98 $result = [
99{foreach from=$widgets key=table item=columns}
100 '{$table}' => [
101{foreach from=$columns key=column item=widget}
102 '{$column}' => [
103{foreach from=$widget key=name item=value}
104 '{$name}' => "{$value}",
105{/foreach}{* /foreach from=$widget item=value *}
106 ],
107{/foreach}{* /foreach from=$columns item=widget *}
108 ],
109{/foreach}{* /foreach from=$widgets item=columns *}
110 ];
313df5ee 111 {rdelim}
3eb2aab1
TO
112 return $result;
113 {rdelim}
114
6a488035 115{rdelim}