Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Apologies to on-the-ball plugin developers
Sorry to anyone who’s already made their plugins “4.6 ready”. A late-breaking change a few days ago has the possibility to break your hard work.
In summary, you can no longer use the backwards-compatibility hack of underscores as pseudo-namespaced class names. You have to use the full namespace:
Txp::get('\Textpattern\Tag\Registry')
->register(array('abc_class', 'method'), 'abc_your_tag');
or
Txp::get('\Textpattern\Tag\Registry')
->register('abc_function', 'abc_your_tag');
or you can import the namespace first with use
so you don’t have to refer to the full path.
Many apologies.
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: Apologies to on-the-ball plugin developers
Thanks for the warning, Stef, and nothing to apologize for – on the ball comme on the ball. Meanwhile, what will happen with the ancient code – will tags just not be registered?
if(class_exists('Textpattern_Tag_Registry'))
Txp::get('Textpattern_Tag_Registry')->register('abc_plugin');
Offline
Re: Apologies to on-the-ball plugin developers
etc wrote #296475:
what will happen with the ancient code – will tags just not be registered?
If you’ve defended against this with a conditional then yes, your tags will remain unregistered and will trigger the warning. Nothing untoward will happen at the moment, everything will still work when production status is Live. It’s only if you haven’t defended against it that the plugin will stop with an unceremonious error.
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: Apologies to on-the-ball plugin developers
Does this mean that all non supported plugins will be rendered useless or will they just through the error in any mode by live?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Apologies to on-the-ball plugin developers
colak wrote #296477:
Does this mean that all non supported plugins will be rendered useless or will they just through the error in any mode by live?
If I understand this correctly, there is no reason why people can’t just edit a plugin right in the Textpattern interface.
Offline
Re: Apologies to on-the-ball plugin developers
colak wrote #296477:
Does this mean that all non supported plugins will be rendered useless
Nope. It’s only a warning. Existing plugins will remain operational, it’s only those people that may have made 4.6-aware plugins already that will need to change the code so their tags are registered.
Live installations are unaffected for the time being, but we’ll be removing unregistered tag support in a version or two. Easy to fix, as michaelkpate says, for those plugins that are orphaned.
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
#7 2015-11-10 23:55:33
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: Apologies to on-the-ball plugin developers
Bloke wrote #296474:
Sorry to anyone who’s already made their plugins “4.6 ready”.
Just when I thought I was organised …!
OK, can someone spell out what the new “4.6 ready” code would be (i.e. to cater for plugins running in 4.5 AND 4.6)?
Offline
Re: Apologies to on-the-ball plugin developers
gomedia wrote #296532:
OK, can someone spell out what the new “4.6 ready” code would be (i.e. to cater for plugins running in 4.5 AND 4.6)?
For most plugins, you’ll have to add something like this, assuming the plugin has two tags, abc_foo and abc_bar:
if(class_exists('\Textpattern\Tag\Registry')) {
Txp::get('\Textpattern\Tag\Registry')
->register('abc_foo')
->register('abc_bar');
}
The examples Bloke gives are more advanced, in case you’ve written an plugin with object oriented code or if the taghandler function differs from the tag name.
Offline