X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=xml%2Ftemplates%2Fschema_structure.tpl;h=9fe7d953ff3b25f3ccb6f4ce8a6faaae9d425e99;hb=9634dbac5efa59168f493f101f8691c1f448b0a2;hp=a12f402e567adacabb8a606fee61164c4f03c118;hpb=7f874ed2330864693882bd7c1400ba43269df7b2;p=civicrm-core.git diff --git a/xml/templates/schema_structure.tpl b/xml/templates/schema_structure.tpl index a12f402e56..9fe7d953ff 100644 --- a/xml/templates/schema_structure.tpl +++ b/xml/templates/schema_structure.tpl @@ -1,135 +1,131 @@ array( - {foreach from=$types key=column item=type} - '{$column}' => "{$type}", - {/foreach} - ), - {/foreach} - ); - {rdelim} - return $result; + /** + * Get translatable columns. + * + * @return array + * A table-indexed array of translatable columns. + */ + public static function &columns() {ldelim} + static $result = NULL; + if (!$result) {ldelim} + $result = [ +{foreach from=$columns key=table item=types} + '{$table}' => [ +{foreach from=$types key=column item=type} + '{$column}' => "{$type}", +{/foreach}{* /foreach from=$types item=type *} + ], +{/foreach}{* /foreach from=$columns item=types *} + ]; {rdelim} + return $result; + {rdelim} - /** - * Get a table indexed array of the indices for translatable fields. - * - * @return array - * Indices for translatable fields. - */ - public static function &indices() - {ldelim} - static $result = null; - if (!$result) {ldelim} - $result = array( - {foreach from=$indices key=table item=tableIndices} - '{$table}' => array( - {foreach from=$tableIndices key=name item=info} - '{$name}' => array( - 'name' => '{$info.name}', - 'field' => array( - {foreach from=$info.field item=field} - '{$field}', - {/foreach} - ), - {if $info.unique}'unique' => 1,{/if} - ), - {/foreach} - ), - {/foreach} - ); - {rdelim} - return $result; + /** + * Get a table indexed array of the indices for translatable fields. + * + * @return array + * Indices for translatable fields. + */ + public static function &indices() {ldelim} + static $result = NULL; + if (!$result) {ldelim} + $result = [ +{foreach from=$indices key=table item=tableIndices} + '{$table}' => [ +{foreach from=$tableIndices key=name item=info} + '{$name}' => [ + 'name' => '{$info.name}', + 'field' => [ +{foreach from=$info.field item=field} + '{$field}', +{/foreach}{* foreach from=$info.field item=field *} + ], + {if $info.unique}'unique' => 1,{/if} + + ], +{/foreach}{* /foreach from=$tableIndices item=info *} + ], +{/foreach}{* /foreach from=$indices item=tableIndices *} + ]; {rdelim} + return $result; + {rdelim} - /** - * Get tables with translatable fields. - * - * @return array - * Array of names of tables with fields that can be translated. - */ - static function &tables() - {ldelim} - static $result = null; - if (!$result) {ldelim} - $result = array_keys(self::columns()); - {rdelim} - return $result; + /** + * Get tables with translatable fields. + * + * @return array + * Array of names of tables with fields that can be translated. + */ + public static function &tables() {ldelim} + static $result = NULL; + if (!$result) {ldelim} + $result = array_keys(self::columns()); {rdelim} + return $result; + {rdelim} - /** - * Get a list of widgets for editing translatable fields. - * - * @return array - * Array of the widgets for editing translatable fields. - */ - static function &widgets() - {ldelim} - static $result = null; - if (!$result) {ldelim} - $result = array( - {foreach from=$widgets key=table item=columns} - '{$table}' => array( - {foreach from=$columns key=column item=widget} - '{$column}' => array( - {foreach from=$widget key=name item=value} - '{$name}' => "{$value}", - {/foreach} - ), - {/foreach} - ), - {/foreach} - ); - {rdelim} - return $result; + /** + * Get a list of widgets for editing translatable fields. + * + * @return array + * Array of the widgets for editing translatable fields. + */ + public static function &widgets() {ldelim} + static $result = NULL; + if (!$result) {ldelim} + $result = [ +{foreach from=$widgets key=table item=columns} + '{$table}' => [ +{foreach from=$columns key=column item=widget} + '{$column}' => [ +{foreach from=$widget key=name item=value} + '{$name}' => "{$value}", +{/foreach}{* /foreach from=$widget item=value *} + ], +{/foreach}{* /foreach from=$columns item=widget *} + ], +{/foreach}{* /foreach from=$widgets item=columns *} + ]; {rdelim} + return $result; + {rdelim} + {rdelim}