Closed dtcblyth closed 2 weeks ago
Hi @dtcblyth, sorry for being late to reply. There was a fundamental change related to Style::add
and this effects how it works now. You can read the explanation here.
Some following up TODO to make sure this changes fully addressed:
This task is blocked by D5 :: Fatal Error :: Fix fatal error due to missing file in Parent Module.
BTW, we provided code example in Divi Extension Example Modules here D5 :: Module Styles :: Add example of style output value format in FE module styles. With this example added, I'm going to close and resolve this issue. Feel free to open new one if you guys have other questions, thanks!
The Problem:
Since updating to Pub-Alpha 1, none of my 3P module styles are being output on the front-end. I have being generating styles mostly the same way since Dev-Alpha, and suddenly it’s not working anymore. Furthermore, I can see that since Pub-Alpha, ET are suddenly no longer using individual trait files for the various aspects of the front-end module. I have so many questions about this, namely:
1) Why this late change? 2) Are we also required to refactor our modules? 3) Is this change the likely reason behind why my front-end styles are no longer being generated?
Another problem, most likely related, is that in some of my modules I am now seeing
Array to string conversion in...
warnings being generate by my style trait functions. These warnings tend to appear on the first load following a save, then dissappear on the second load... pressumably after the page is cached. Once again, this was not happening prior to Pub-Alpha 1.I really need a quick answer on this. I don’t want to waist time trying to track down the cause of this if it is a bug. And, if it is not a bug and I need to refactor all my module front-end styles, then I need to get on to that as quickly as possible.
Example:
To give a little more insight into how I structure my styles I have put a simplified code sample below. I like to modularise my styles in separate styles traits, more-or-less organised by element, as I find this helps for more complex modules. See below:
ModuleStylesTrait.php:
StylesFunctions/StylesHeadingTrait.php:
What I’ve Tried:
From the quick testing I have done... in the example above, if I move this...
... into the main
module_styles()
function it works, but keeping it in a separatestylesHeading()
function, as I have been doing since Dev-Alpha, no longer works.Also, declaring static styles, like this...
... no longer seems to work in any configuration.