Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#31 2018-07-16 15:19:09
- NicolasGraph
- Plugin Author
- From: France
- Registered: 2008-07-24
- Posts: 860
- Website
Offline
#32 2018-07-16 16:34:48
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,072
- Website
Re: Making your plugins 4.7-aware
NicolasGraph wrote #313030:
Because the tag could be used by its own as a container, I uses
return parse($thing, $out)
, however, its triggers an error when$out
isfalse
.
Thanks, this error is weird, will investigate.
Doing
return $out ? $thing : '';
does work but it would not parse potentialelse
contents.
You can not make global attributes work this way atm, because the $thing
they get is generally already parsed (by the tag) and does not contain <txp:else />
anymore. We could (will?) introduce {pre}parsing global attributes, but, in this case, there would be an ambiguity re the false
part in, say
<txp:if_something if_something_else>...<txp:else />...</txp:if_something>
In my case I could check if the tag was used through the global attribute to conditionate the return, but it could be a problem if the global attribute wouldn’t have its own name I guess.
I don’t know if the parser should manage this kind of use or not, or if, has I aked before, there should be a convention about global attributes to name them differently than others; in which case checking the use of a global attribute could seem alright.
When the parser processes global attributes, $pretext['_txp_atts']
is set to true
. You can check it, though this may change one day.
Offline
#33 2018-07-17 06:56:12
- NicolasGraph
- Plugin Author
- From: France
- Registered: 2008-07-24
- Posts: 860
- Website
Re: Making your plugins 4.7-aware
etc wrote #313037:
Thanks, this error is weird, will investigate.
Ok, thanks.
You can not make global attributes work this way atm, because the
$thing
they get is generally already parsed (by the tag) and does not contain<txp:else />
anymore. We could (will?) introduce _pre_parsing global attributes, but, in this case, there would be an ambiguity re thefalse
part in, say
Yes, I understand, I was just saying that return $out ? $thing : '';
would obviously not work if used through the tag with a potential else
clause. I don’t try to use any else
clause through the global attribute.
When the parser processes global attributes,
$pretext['_txp_atts']
is set totrue
. You can check it, though this may change one day.
Noted.
Offline