I found a solution to this. In my other project I use this function in my settings class:
public function lal_get_settings( $index = false ) {
$defaults = array ( 'lal_display_type' => 'icon', 'lal_add_fa' => false);
$settings = get_option( 'lal_settingz', $defaults );
if ( $index && isset( $settings[ $index ] ) ) {
return $settings[ $index ];
}
return $settings;
}
Then outside the class in the main php file:
$args = array (
'display_type' => $lal_settingz_page->lal_get_settings('lal_display_type'),
'add_fa' => $lal_settingz_page->lal_get_settings('lal_add_fa')
);
Whenever I want to pass these settings as arguments, I use the following construction:
add_action('wp_enqueue_scripts', function() use ( $args ) { login_account_logout( $args ); }, 1);
function login_account_logout( $args ) {
if ( $args['display_type'] === 'icon' && $args['add_fa'] == 1 )
wp_enqueue_style('lal-CDN-font-awesome', '//use.fontawesome.com/releases/v5.8.2/css/all.css');
}
I can pass these arguments further, to nested actions in the same way.