XF 2.2 Change addon-options from a class?

Robert9

Well-known member
I have seen really a lot of addons, but i cant remember any addon-option changed from another place than the usual one.
For my addon it makes absolutely sense to change options directly from an admin view.

to use an option in my class, i use:

$showAllCountries = \XF:options()->xsa_showallcountries;

but how can i change this option now directly from my class, please?
 
Solved and happy

Code:
if ($showAllCountries == 1)
            $showAllCountries = 0;
        else
            $showAllCountries = 1;
            
        \XF::repository('XF:Option')->updateOption('xsa_showallcountries', $showAllCountries);
 
Wow! This is awesome.
Did you all ever thought about how nice it could be to toogle views in the admin area?

Just one button and i can see all my countries or only the active ones.


firefox_I1Oo35va1e.webpfirefox_eU2OidYtKX.webp
 
Top Bottom