Tom. Posted March 9, 2021 Posted March 9, 2021 Hello, I believe I found a bug (https://processwire.com/api/ref/wire/wire/); // Create a new API variable named 'widgets' $this->wire('widgets', $widgets); This didn't work but. // Alternate syntax for the two above $this->wire()->set('widgets', $widgets); Did work. This was in the `init.php` file using just `wire()` not `$this->wire()`. Anyone else had this issue?
BitPoet Posted March 9, 2021 Posted March 9, 2021 There's a small but important difference between wire() and $anything->wire(). The first is the wire() function defined in Functions.php and documented here. The other is the Wire::wire() method you linked to. The first one just retrieves values but can't set them. So it's more of an inconsistency between those two than a bug. 3
adrian Posted March 10, 2021 Posted March 10, 2021 I always use this approach: $this->wire("siteSettings", $modules->get('SettingsFactory')->getSettings('settings')); and it sets it just fine. I put it in init.php 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now