Skip to content

Instantly share code, notes, and snippets.

@uzaharova
Created October 27, 2017 11:33
Show Gist options
  • Save uzaharova/64af45789680783dbb3bfeef6f8e3814 to your computer and use it in GitHub Desktop.
Save uzaharova/64af45789680783dbb3bfeef6f8e3814 to your computer and use it in GitHub Desktop.
diff --git a/_docs/developer_changes/patch.md b/_docs/developer_changes/patch.md
index 97cdb01..bc2c961 100644
--- a/_docs/developer_changes/patch.md
+++ b/_docs/developer_changes/patch.md
@@ -2,7 +2,7 @@
### New function
* `fn_is_lang_var_exists($value)` - Checks availability of translation for the variable.
-* `fn_exim_get_field_lable($value)` - Gets the translation for the variable.
+* `fn_exim_get_field_label($value)` - Gets the translation for the variable.
### Changed functions
diff --git a/app/functions/fn.exim.php b/app/functions/fn.exim.php
index f8f3b49..9b7bb56 100644
--- a/app/functions/fn.exim.php
+++ b/app/functions/fn.exim.php
@@ -1897,10 +1897,10 @@ function fn_exim_apply_company($pattern, &$alt_keys, &$object, &$skip_get_primar
*
* @return bool|string The string with the translation.
*/
-function fn_exim_get_field_lable($value)
+function fn_exim_get_field_label($value)
{
$value = str_replace(array(':', '(', ')', '-'), '', $value);
$value = strtolower(str_replace(' ', '_', $value));
- return $value;
+ return fn_check_language_variable($value) ? __($value) : false;
}
\ No newline at end of file
diff --git a/design/backend/templates/views/exim/components/selectboxes.tpl b/design/backend/templates/views/exim/components/selectboxes.tpl
index a20b730..b9de68e 100644
--- a/design/backend/templates/views/exim/components/selectboxes.tpl
+++ b/design/backend/templates/views/exim/components/selectboxes.tpl
@@ -16,12 +16,14 @@
<select id="{$left_id}" name="{$left_name}[]" multiple="multiple" class="input-full toll-select">
{foreach from=$assigned_ids item=key}
{if $items.$key}
- <option value="{$key}" selected="selected" {if $items.$key.required}class=" selectbox-highlighted cm-required"{/if}>{$key}{if $key|fn_exim_get_field_lable} ({$key|fn_exim_get_field_lable}){/if}</option>
+ {assign var="label" value="{$key|fn_exim_get_field_label}"}
+ <option value="{$key}" selected="selected" {if $items.$key.required}class=" selectbox-highlighted cm-required"{/if}>{$key}{if $label} ({$label}){/if}</option>
{/if}
{/foreach}
{foreach from=$items item="item" key="key"}
{if $item.required && !$key|in_array:$assigned_ids}
- <option value="{$key}" selected="selected" class="selectbox-highlighted cm-required">{$key}{if $key|fn_exim_get_field_lable} ({$key|fn_exim_get_field_lable}){/if}</option>
+ {assign var="label" value="{$key|fn_exim_get_field_label}"}
+ <option value="{$key}" selected="selected" class="selectbox-highlighted cm-required">{$key}{if $label} ({$label}){/if}</option>
{/if}
{/foreach}
</select>
@@ -39,7 +41,8 @@
<select id="{$left_id}_right" name="unset_mbox[]" multiple="multiple" class="input-full toll-select">
{foreach from=$items item=item key=key}
{if !$key|in_array:$assigned_ids && !$item.required}
- <option value="{$key}" {if $item.required}class="selectbox-highlighted cm-required"{/if}>{$key}{if $key|fn_exim_get_field_lable} ({$key|fn_exim_get_field_lable}){/if}</option>
+ {assign var="label" value="{$key|fn_exim_get_field_label}"}
+ <option value="{$key}" {if $item.required}class="selectbox-highlighted cm-required"{/if}>{$key}{if $label} ({$label}){/if}</option>
{/if}
{/foreach}
</select>
diff --git a/design/backend/templates/views/exim/import.tpl b/design/backend/templates/views/exim/import.tpl
index 8cad581..159eba8 100644
--- a/design/backend/templates/views/exim/import.tpl
+++ b/design/backend/templates/views/exim/import.tpl
@@ -24,7 +24,8 @@
<td>
<ul class="unstyled">
{foreach from=$fields key="field" item="f"}
- <li>{if $f.required}<strong>{/if}{$field}{if $field|fn_exim_get_field_lable} ({$field|fn_exim_get_field_lable}){/if}{if $f.required}</strong>{/if}</li>
+ {assign var="label" value="{$field|fn_exim_get_field_label}"}
+ <li>{if $f.required}<strong>{/if}{$field}{if $label} ({$label}){/if}{if $f.required}</strong>{/if}</li>
{/foreach}
</ul>
</td>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment