I'm creating an extension that exposes an API to another web site. My extension will create an API key, and then you'll copy this API key into the other web site, which will let Magento and the other site exchange data.
I've created a system.xml
entry for my API key. I'd like for the default value for this config item to be populated by a call to a generateApiKey
method defined in PHP code.
In pseudocode, config.xml
:
<config>
<default>
<my_extension>
<api_connection>
<apikey><?php echo $obj->generateApiKey(); ?></apikey>
</api_connection>
</my_extension>
</default>
</config>
I know that that's not possible, but hopefully that conveys what I want to do.
How can I programmatically generate (and save) a default value for something defined in system.xml
?