Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2018-04-02 10:38:51

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

Re: Short-tags and shortcodes

Bloke wrote #310557:

Even if I make my shortcode Form name figure I still need the yield attribute if I want to pass in attributes. Otherwise it complains Unknown tag attribute: id etc.

A form called figure can be invoked as shortcode <txp::figure />, but a form called my figure can not, that’s what I meant.

Internally, <txp::shortcode /> is just an alias of <txp:output_form yield form="shortcode" />. The yield attribute means “store extra attributes as values of <txp:yield /> tags inside the form and don’t complain”. Should this be the default behavior of <txp:output_form />? Currently, without yield attribute it issues a Unknown tag attribute warning (whatever form name), but it would be a very minor backwards incompatibility to drop it and use yield mode by default.

Offline

#17 2018-04-02 11:00:52

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

Re: Short-tags and shortcodes

Any discrepencies were likely my fault in reorganzing/editing docs, which is exactly why I wanted people to review the changes.

Offline

#18 2018-04-02 11:03:54

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

Re: Short-tags and shortcodes

etc wrote #310559:

The yield attribute means “store extra attributes as values of <txp:yield /> tags inside the form and don’t complain”. Should this be the default behavior of <txp:output_form />?

Since the functionality to add arbitrary attributes to <txp:output_form> wasn’t available in prior versions, I don’t see any problem with this, and it’s one less attribute for people to have to add by hand.

What b/c issues could arise? I can’t think of any. Presumably we could still use yield="att1, att2, ..." to explicitly name attributes that we want to allow if any corner cases cropped up?

Last edited by Bloke (2018-04-02 11:04:26)


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

#19 2018-04-02 11:11:59

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

Re: Short-tags and shortcodes

Destry wrote #310560:

Any discrepencies were likely my fault in reorganzing/editing docs, which is exactly why I wanted people to review the changes.

I’m to blame too for still changing things in beta, but we’ll nail it.

Bloke wrote #310561:

What b/c issues could arise? I can’t think of any. Presumably we could still use yield="att1, att2, ..." to explicitly name attributes that we want to allow if any corner cases cropped up?

It’s mostly “where’s my warning gone” :-) Ok, I will modify it this way. Sorry for constant doc rewrites it yields.

Offline

#20 2018-04-02 11:15:59

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

Re: Short-tags and shortcodes

etc wrote #310563:

It’s mostly “where’s my warning gone” :-)

Haha! Don’t think anyone would complain about that. Might be a slight issue if someone uses <txp:output_form name="figure" /> instead of form="figure", right? But that should still complain if the mandatory attribute’s missing. Ignore me.

Sorry for constant doc rewrites it yields.

No worries. A better user experience is the ultimate goal.


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