Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-12-22 14:21:25

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,036
Website

File / Image / Link / Section custom fields

These have been around for a while in different stages of development but spurred on by a few requests I’ve finally brought them all up to date and in sync with one another:

  • jcr_file_custom – Custom fields for files – GitHubReleases
  • jcr_link_custom – Custom fields for links – GitHubReleases
  • jcr_image_custom – Custom fields for images – GitHubReleases
  • jcr_section_custom – Custom fields for sections – GitHubReleases

Each adds up to five custom fields to the respective content type and two public tags:

  • jcr_{type}_custom with support for wraptag, class, escape, including the newer escape and <+> wraptag facilities added in more recent versions of Textpattern.
  • jcr_if_{type}_custom with support for value, match and separator attributes, including the standard exact, all, any variants.

As with the regular article custom fields, you can give each a name in the Admin › Preferences area and the corresponding fields then appear in the Edit Pane of the respective content type. You can tailor the form field labels via the “Install Textpack” texture in Admin › Languages. See the plugin help or readme on GitHub for notes about the format.

These versions should be compatible with Textpattern 4.7 and 4.8 and with PHP 7 and 8. They may work with earlier versions but I’m not sure. See the plugin help for full details.

If you’re upgrading from the earlier single custom field version of the plugin, this version will migrate to the new database format and bring across your data. You should not need to change your existing tags in your pages or forms as the new defaults match the old setup. That said, making a safety backup beforehand can’t hurt.

—-

Looking ahead, at some point in future, these plugins will hopefully be superseded by planned core functionality. I will then try and make a plugin to migrate these custom fields to the core custom field format.

As with other plugins, I’ve stood on the shoulders of others before me who are mentioned in the plugin credits.

EDIT: I’ve re-arranged my branches to make this the main branch and the older single custom field version a “legacy” branch. I’ve gone through the forum and tried to correct all past instances of links in forum posts.


TXP Builders – finely-crafted code, design and txp

Offline

#2 2020-12-22 15:52:37

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,469
Website

Re: File / Image / Link / Section custom fields

Thanks for updating these plugins Julian. Admittedly I’m still rooting for the unlimited CF feature in txp.


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#3 2020-12-22 16:22:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,996
Website

Re: File / Image / Link / Section custom fields

colak wrote #327749:

Admittedly I’m still rooting for the unlimited CF feature in txp.

Aren’t we all! If Oleg has some time soon I’m hoping he can merge the latest 4.9.0 dev changes into the custom fields branch. It’s drifted a lot and I’d screw it up if I tried to do the merge.

Once that’s done I’m going to knuckle down and finish it.

Last edited by Bloke (2020-12-22 16:22:54)


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

#4 2020-12-22 23:01:58

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,233
Website

Re: File / Image / Link / Section custom fields

Thanks for keeping those alive and publishing them here on the forum.

(while we all patiently wait for unlimited custom fields in Core – knock fingers on wood)


Where is that emoji for a solar powered submarine when you need it ?

Offline

#5 2020-12-23 11:41:22

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,663
Website

Re: File / Image / Link / Section custom fields

jakob wrote #327748:

jcr_link_custom – Custom fields for links

This has been wonderful for my bibliography handling for the glossary project and I thank you for it.

By the time that project is ready to launch, ECFs will probably already have landed and I’ll need to convert. But this gives me a good model to work from.

In that respect, I could use a few more fields to make building the citations list even more granular, as I would try with full ECFs.

I will try looking at the plugin code, maybe it’s just copy/pasty some lines and changing names?

Offline

#6 2020-12-23 12:03:59

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,036
Website

Re: File / Image / Link / Section custom fields

Destry wrote #327763:

I will try looking at the plugin code, maybe it’s just copy/pasty some lines and changing names?

It’s easier than that. You just need to update to the new version (see the releases) and it will bring everything over from your existing custom field (make a backup first for peace of mind). You can then add more custom fields by visiting Admin › Preferences and naming them – just like with the regular article custom fields. If you give three of them a name, you’ll see three fields in the links panel, your existing one and two new ones.

And you can check if you are already using the multi-field version by looking under Admin › Preferences whether there are already options there.


TXP Builders – finely-crafted code, design and txp

Offline

#7 2020-12-23 13:16:18

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,663
Website

Re: File / Image / Link / Section custom fields

jakob wrote #327765:

It’s easier than that. You just need to update to the new version . . . then add more custom fields by visiting Admin › Preferences and naming them – just like with the regular article custom fields.

Nice! On the to-dos.

Offline

#8 2020-12-25 22:50:35

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,453

Re: File / Image / Link / Section custom fields

Thank you jakob for these useful plug-ins.

Offline

Board footer

Powered by FluxBB