# How to pass a variable to module settings

**URL:** <https://forum.oxid-esales.com/t/how-to-pass-a-variable-to-module-settings/96029>\
**Category:** English forums\
**Tags:** development, dev-talk\
**Created:** [December 4, 2019, 11:25am UTC](https://forum.oxid-esales.com/t/how-to-pass-a-variable-to-module-settings/96029 "2019-12-04T11:25:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![NewOx](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/n/7bcc69/32.png) [@NewOx](https://forum.oxid-esales.com/u/NewOx)\
**Post date:** [December 4, 2019, 11:26am UTC](https://forum.oxid-esales.com/t/how-to-pass-a-variable-to-module-settings/96029/1 "2019-12-04T11:26:00Z")

</div>

Hello guys,

I am using Oxid 6 with PHP version 5.6  
I have a function for generating random string in a class in the file modules/moduleName/admin/function-file:

public static function generateRandomString($length = 30) {  
return substr(str\_shuffle(str\_repeat($x=‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’, ceil($length/strlen($x)) )),1,$length);  
}

In the same class I have other function:

public static function onActivate()  
{

```
    try {

        self::generateRandomString();
        self::alterTableColumns();
        self::updateDBViews();
        self::clearShopTmp();

        $newApi = self::generateRandomString();
        
        // var_dump($newApi);die();

    } catch(Exception $e) {
        oxRegistry::get("oxutilsview")->addErrorToDisplay(new oxException($e->getMessage()));    
    }
}

```

My question is: How can I pass this variable ($newApi) in the module settings in: moduleName/application/views/admin/en(de)/here\_lang.php ?  
E.g:  
$aLang = array(  
‘charset’ =\> ‘UTF-8’,  
‘SHOP\_MODULE\_GROUP\_name’ =\> ‘Something’,  
‘SHOP\_MODULE\_configuration’ =\> ‘Something’,  
‘SHOP\_MODULE\_api\_key’ =\> ‘API Key’,  
‘SHOP\_MODULE\_checkbox\_generateApiKey’ =\> **$here** ,

);  
Thanks

---

<div class="post-metadata">

**Author:** ![vanilla\_thunder](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/vanilla_thunder/32/72_2.png) [@vanilla\_thunder](https://forum.oxid-esales.com/u/vanilla_thunder)\
**Post date:** [December 4, 2019, 12:12pm UTC](https://forum.oxid-esales.com/t/how-to-pass-a-variable-to-module-settings/96029/2 "2019-12-04T12:12:54Z")

</div>

```auto
$aLang = array(
...
'SHOP_MODULE_checkbox_generateApiKey' => substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil(30/strlen($x)) )),1,30)

```

but it will be random every time you reset reset language cache

---

<div class="post-metadata">

**Author:** ![NewOx](https://forum.oxid-esales.com/letter_avatar_proxy/v4/letter/n/7bcc69/32.png) [@NewOx](https://forum.oxid-esales.com/u/NewOx)\
**Post date:** [December 4, 2019, 12:27pm UTC](https://forum.oxid-esales.com/t/how-to-pass-a-variable-to-module-settings/96029/3 "2019-12-04T12:27:26Z")

</div>

Thank you, this works.

Do you know how can I make on click on the checkbox this same string to appear in the higher text input element as value or in placeholder but not to be saved in the database?

---

<div class="post-metadata">

**Author:** ![vanilla\_thunder](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/vanilla_thunder/32/72_2.png) [@vanilla\_thunder](https://forum.oxid-esales.com/u/vanilla_thunder)\
**Post date:** [December 4, 2019, 12:54pm UTC](https://forum.oxid-esales.com/t/how-to-pass-a-variable-to-module-settings/96029/4 "2019-12-04T12:54:37Z")

</div>

oxid does not support that.

---

<div class="post-metadata">

**Author:** ![system](https://forum.oxid-esales.com/user_avatar/forum.oxid-esales.com/system/32/4245_2.png) [@system](https://forum.oxid-esales.com/u/system)\
**Post date:** [July 13, 2026, 7:41pm UTC](https://forum.oxid-esales.com/t/how-to-pass-a-variable-to-module-settings/96029/5 "2026-07-13T19:41:59Z")

</div>

Closed on July 13, 2026, 7:41pm UTC


