I’m trying to create a child theme of the defaultManuscript theme (grandchild theme of the default theme) in OJS v3.1.2, but am facing an issue that is confounding me.
In the init() function of my BNZSEEManuscriptThemePlugin class, I have the following two lines:
The contents of my styles/variables.less file is as follows (just for testing):
@bg: #222;
For some reason though, this results in me seeing the default theme with a dark background; not the defaultManuscript theme with a dark background as I’d expect.
If I comment out the line with the modifyStyle command though, I see the defaultMansucript theme unchanged.
Not quite sure what I’m doing wrong here. Any help would be much appreciated.
If I understand the problem right, you cannot apply your styling modifications from a child of a Manuscript theme, right? I’ve made a testing just as you described and all works well in my case.
Very strange indeed. I’ve placed my code creating a child of the defaultManuscript theme here: Dropbox - File Deleted
Upon loading this theme as is, I get the following results:
Upon commenting the $this->modifyStyle('stylesheet', array('addLess' => array('styles/variables.less'))); line in the BNZSEEManuscriptThemePlugin.inc.php file, I get the following results:
I’m finding it hard to understand why the inclusion of that one line produces the default theme with a dark background rather than the defaultManuscript theme with a dark background.
It’s been about seven months now. Just wanted to check in to see if any progress has been made in resolving this yet? It’s really holding up our site development and launch.
I’m giving upgrading a shot, but it seems like quite a big ordeal considering the amount of code that has been changed outside the theme folder, and will take a lot more work. This was actually the reason we are looking at consolidating all of these code changes into a child theme, so that future upgrades are a bit smoother.
Would it be possible at all for you to test this on OJS release 3.1.2-2 at your end, using the troubleshooting information I’ve provided above? So sorry for the trouble.
Just wanted to check in to see if you might be able to test this at your end. It will be quite a significant ordeal to attempt an upgrade of our journal’s OJS website.
Unfortunately, I don’t have 3.1.2-2 instance to test. According to the commit and release timing, it should be fixed starting from version 3.1.2-2.
BTW the latest release is 3.1.2-4. You can test it first locally if have doubts. Moreover, you can use local OJS instance for development and debugging of a child theme.
Thanks for that suggestion. I made a local copy of our OJS website, upgraded to version 3.1.2-4, and can see that the issue still persists. It has not been fixed.
Sorry, my mistake. I was thinking about similar issue for child themes but related to templates.
I’ve tested and was able to reproduce the problem.
Can you make minor change in the code in your OJS test instance?
What happens if you replace the line 236 $style = array_merge($style, $args);
to $style = array_merge_recursive($style, $args);
in ThemePlugin.inc.php file, which can be found in folder lib/pkp/classes/plugins/
In the current version of OJS stable branch the correspondent line is here: pkp-lib/ThemePlugin.inc.php at stable-3_1_2 · pkp/pkp-lib · GitHub
Just tried your suggestion. It does appear to solve the primary problem but has a few side effects, such as changing a few colours of the defaultManuscript theme. Screenshots of the website before and after making the change are attached below.
BEFORE:
AFTER:
Just to clarify, these effects are observed in the currently used defaultManuscript theme itself, not the child theme of the defaultManuscript I am testing at the side.
@Vitaliy I haven’t tested it out but it makes sense at first glance. The lines of code should also work in cases where it’s not an array. Try the following:
if (isset($args['addLessVariables'])) {
foreach ((array) $args['addLessVariables'] as $addlessVariables) {
$less->parse($addlessVariables);
}
}
@NateWr, @Vitaliy - I just upgraded our OJS site to v3.2.1.1 and found that this patch has still not been added to the code. Could this be added to the next release so I don’t have to apply this patch after each upgrade? Thanks!
Hi @reagan, can you provide a pull request with this change to the pkp-lib repository? If possible, also provide an example theme where we can test the change.
When you open the pull request, feel free to tag me with @NateWr to be sure that I see it.