Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-05-10 06:31:39

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

class CategoryConstraints not found

Hi,
after upgrading 4.5.7>4.7.2 I run into an error in one of my plugins regarding CategoryConstraints:

Fatal error: Uncaught Error: Class ‘CategoryConstraint’ not found in /…/textpattern/lib/txplib_misc.php(1870) : eval()’d code:334 Stack trace: #0 /…/lib/txplib_misc.php(1989): sac_imagecopynotes_save(‘image’, ‘image_save’) #1 /…/textpattern/index.php(258): callback_event(‘image’, ‘image_save’, 0) #2 {main} thrown in /…/lib/txplib_misc.php(1870) : eval()’d code on line 334

(Basically I used core-image-code and added a copyright-field … which will now not be saved.)

My Diagnose reports CategoryConstraint.php is present.

But the Class isn’t found.

I’m not too skilled with classes and stuff like that.
But I understood that there was some change between 4.5.7/4.6 and 4.7
Can anyone help me?

Offline

#2 2019-05-10 06:52:22

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

Re: class CategoryConstraints not found

I’m not sure about your original question, but you may be able to adapt jcr_image_custom to work with the table column you used for your copyright field, and rename – or make an alias to – the public txp:tag in the plugin to match your own.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2019-05-10 07:12:26

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

Re: class CategoryConstraints not found

Re: your original question, take a look at txp_image.php (and this search on GitHub) where you can see how the categoryConstraint class is now being included. If your plugin was very old, the error is probably because some functions were separated out into the vendors folder and your code no longer knows where it is.

If you don’t actually need the rest of the code, the method above with a plugin that hooks into the existing image edit pane may still be better…


TXP Builders – finely-crafted code, design and txp

Offline

#4 2019-05-10 08:13:18

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

Re: class CategoryConstraints not found

Thank You, jakob, great!
I simply didn’t notice the way categoryConstraint is included now,

adding

use Textpattern\Validator\CategoryConstraint;
use Textpattern\Validator\Validator;
use Textpattern\Search\Filter;

did it.

Thank you for this very quick response and solution!

Offline

Board footer

Powered by FluxBB