Perhaps implementing a settings.php in your theme or block can be an idea:
$chk = new admin_setting_configtext( 'theme_xxx/chk', 'variable', 'help for variable', 'defaultvalue');
$chk->set_updatedcallback('theme_reset_all_caches');
$settings->add($chk);
The value of this setting can be queried everywhere using $setting = get_config('theme_xxx', 'chk')