Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Admin theme customisation
Leading question:
Does anybody currently add a file called prefs.json to their admin theme installation folder, to define additional public-side prefs and style blocks?
If I’m reading this Theme code right:
if (!empty($prefs['textpattern'])) {
$content = json_encode($prefs['textpattern'], TEXTPATTERN_JSON);
$out .= \Txp::get('\Textpattern\UI\Script', "textpattern.prefs = jQuery.extend(textpattern.prefs, {$content})").n;
}
if (!empty($prefs['style'])) {
$content = $prefs['style'];
$out .= \Txp::get('\Textpattern\UI\Style', n.$content.n);
}
That allows you to add a ‘textpattern’ node to prefs.json in any admin theme folder, which will extend the public JavaScript `textpattern.prefs` object with your own. Presumably that’s for adding JS strings and stuff that your theme might need, over and above what’s in core already.
In addition, it will inject any content defined in a prefs.json ‘style’ node as inline styles.
The above is in addition to using custom.css and/or custom.js, which will read those files (not content) and add them as <link> targets to be loaded with your theme.
I’m only asking because I have a half-baked enhancement that I might squeeze into 4.9.0 if there’s time between now and next weekend, and if nobody is using this prefs.json file, I’m tempted to rename it because it’s a daft name for what it does.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Admin theme customisation
I did not know this option eventually existed – and at first sight, it is not documented (I may have missed that though). So no, unused on my side.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Offline
Re: Admin theme customisation
That’s what I hoped the answer would be from both people I expect are the only candidates for using this undocumented feature :)
Thank you. If I can get this thing to work then I’ll rename the file to custom.json instead.
Any more people using it?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Offline
Pages: 1