Hello.
I updated to the latest Sage 9.0.4 and was wondering what happened with the Controller update: I can’t seem to call App::myFunction() from within setup.php anymore? This worked in previous releases, but perhaps it’s wrong to do that in any case.
How can I properly access those methods here?
Just for better understanding, I’m doing something like this for example in setup.php:
/**
* Theme assets
*/
add_action('wp_enqueue_scripts', function () {
wp_enqueue_style('sage/main.css', asset_path('styles/main.css'), false, null);
wp_enqueue_script('sage/main.js', asset_path('scripts/main.js'), ['jquery'], null, true);
$script_params = array(
'theme_dir_uri' => App::themeDirURI(), // this worked in previous Controller versions
'ajax_url' => App::ajaxURL(),
'ajax_nonce' => wp_create_nonce('my_nonce'),
'home_url' => home_url(),
'translations' => array(
'back_to_top' => __('Back to top', 'my'),
'back_to_home' => __('Back to home page', 'my')
),
);
wp_localize_script('sage/main.js', 'GLOBAL_OBJECT', $script_params);
}, 100);
Now using App::myfunction() throws: Call to undefined function ..
so I’m clearly doing something wrong from the start.
Thanks!