Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2025-11-28 13:56:07

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: Admin theme customisation

Okay, it’s only three lines of code so now there’s a helper method in the Theme class to get theme pref values:

$value = $this->get_pref('my_pref_name');

That prepends the name and pipe for you. Much nicer :)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#17 2025-12-05 01:24:16

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,252
Website Mastodon

Re: Admin theme customisation

just noticed that the new Admin UI (v4.9.0-dev) no longer has the quick GO tab to go to a specific area- -articles, pages, forms, etc. It now is replaced with LOGOUT tab. I do miss it in the new UI…
Don’t know if the older sites had plugin for this function (which I don’t see on my sites), so I thought I would ask here?
This might have been discussed elsewhere but I could not find mention in my search.


…. texted postive

Offline

#18 2025-12-05 06:14:16

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,631
Website

Re: Admin theme customisation

bici wrote #341496:

just noticed that the new Admin UI (v4.9.0-dev) no longer has the quick GO tab to go to a specific area- -articles, pages, forms, etc. It now is replaced with LOGOUT tab. I do miss it in the new UI…
Don’t know if the older sites had plugin for this function (which I don’t see on my sites), so I thought I would ask here?
This might have been discussed elsewhere but I could not find mention in my search.

You need to use the “Classic” theme for that. Hive, the default admin theme since… since 4.6? does not use that. Go to Admin > Preferences, click on admin in the list and scroll down to select an admin theme


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#19 2025-12-05 07:12:49

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,252
Website Mastodon

Re: Admin theme customisation

Thanks. Unfortunate that it could not have been incorporated in Hive. i still use classic on two of my sites and hive on two others. Admittedly i use it infrequently, even though it is at times useful…


…. texted postive

Offline

#20 2025-12-05 08:20:55

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,182
Website GitHub

Re: Admin theme customisation

bici wrote #341496:

just noticed that the new Admin UI (v4.9.0-dev) no longer has the quick GO tab to go to a specific area- -articles, pages, forms, etc. It now is replaced with LOGOUT tab. I do miss it in the new UI…

I vaguely remember there being a plugin for that but can’t recall what it was called.


TXP Builders – finely-crafted code, design and txp

Offline

#21 2025-12-05 13:48:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: Admin theme customisation

One thing that may need some thought is l10n/i18n. Using hive as an example, the language strings in the database are currently defined as:

hive|thumb_width
hive|thumb_height
hive|thumb_cropping
hive|instructions_thumb_cropping
...

Although the key names (in this case) need to be hard-wired so the Images panel can pick them up, they all need namespacing in some way to avoid clashes with other strings: in case an admin theme wants to call the same string something different, for clarity.

The textpack itself, if housed inside the admin-theme’s own folder, can omit the namespace prefix hive| because it will be automatically added when the strings are imported by core.

For custom-built admin themes, this doesn’t pose much of an issue because the theme author is responsible for its upkeep and if they provide any translations, they’ll do it in each successive release of their own textpack.txp file.

But for the core themes it’s a different matter. In order for translators to “know” about the new strings we need them in the core’s main lang/textpacks OR we need to somehow extend the reach of CrowdIn so it ‘knows” of the existence of these other textpack files in the different (admin-themes) repos.

Further, if these are somehow brought into CrowdIn centrally, the string keys will need to be namespaced when they’re imported into CrowdIn and then the namespace stripped off when the script to drag the keys down distributes them between the core /lang/textpacks and the core /admin-theme/{themename}/textpack.txp.

There’s a further annoyance that (in the case of these common prefs), the translations are all identical. It’s a bit of a burden for translators to copy n paste them all to each theme. So it’d be grand if we could somehow flag strings as “for a theme” in CrowdIn, and only have one copy up there which. is automagically duplicated and prefixed on export when creating the individual theme textpack.txp files.

Does anybody have any thoughts on how best to manage this?

Last edited by Bloke (2025-12-05 13:52:28)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#22 2025-12-05 13:56:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: Admin theme customisation

Side note: should we enforce a similar admin-theme/{themename}/lang/{lang-id}.ini folder structure for themes, instead of all translations in one theme-root-level textpack.txp file? It seemed overkill, for the few strings that a theme may need, to have multiple files, but I can be swayed.

Last edited by Bloke (2025-12-05 13:57:33)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#23 2025-12-06 00:12:13

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,631
Website

Re: Admin theme customisation

Bloke wrote #341540:

Side note: should we enforce a similar admin-theme/{themename}/lang/{lang-id}.ini folder structure for themes, instead of all translations in one theme-root-level textpack.txp file? It seemed overkill, for the few strings that a theme may need, to have multiple files, but I can be swayed.

For a few strings, I think what we have now is OK. If an admin-theme is heavily customised for a specific (poly-lingual) client/organisation/company… with many languages needed, those would still be loaded immediately I think.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#24 2025-12-07 09:05:14

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,631
Website

Re: Admin theme customisation

How does that work if a theme ships with a set of entries in the prefs.json file (the thumbnail prefs discussed in the other thread). User installs the theme, the prefs are registered. All OK. Later, some additional fields are added. User upgrade. The additional fields do not seem to appear in the admin? I updated the theme version in manifest.json etc.

–^–

Then coming back to that basic example given above, On another install the two fields appear in the admin, but I am a little unclear how to use them. I added $value = $this->get_pref('my_pref_name'); in the @function html_head() {} block. From there I am not sure what further steps I need.

One idea for a pref: let the user define the space reserved for the thumbnail on the Images list panel. Currently it has a hardcoded width and aspect-ratio in the theme CSS. The idea would be to use some --thumb-img-width CSS custom property and then let have the user fill the width if desired. That would mean adding an entry a (in a <style>selector {--thumb-img-width: /* insert $uservalue */}</style>) block at the end of head. Not clear how to handle this.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#25 2025-12-07 11:20:54

etc
Developer
Registered: 2010-11-11
Posts: 5,661
Website GitHub

Re: Admin theme customisation

Hmm, why INSERT INTO txp_lang is run on every admin page access, seemingly trying to (re)insert theme thumbnail strings?

Offline

#26 2025-12-07 11:36:49

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: Admin theme customisation

Needs optimising. My mistake. By all means improve it, thank you.

I’ve also had a change of mind over checking for image garbage collection on every page load. Going to change that later so it only does it on the images panel.

The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB