Eleeist
Eleeist

Reputation: 7041

Custom HTML parameters for component

When you use standard t:pagelink component you can pass arbitrary number of custom HTML attributes like class or some data attributes:

<t:pagelink page="somepage" data-somedata="test">link name</t:pagelink>

And they will be included in generated a tag:

<a href="/somepage" data-somedata="test">link name</a>

This does not work for components created by me. When I have:

<t:misc.custompagelink page="somepage" data-somedata="test">link name</t:misc.custompagelink>

The generated HTML looks like this:

<a href="/somepage">link name</a>

How to mimick the behaviour of standard t:pagelink component?

Upvotes: 1

Views: 119

Answers (1)

Bob Harner
Bob Harner

Reputation: 754

There are 2 ways to do this, both easy:

1) Read and follow the "Informal Parameters" section at http://tapestry.apache.org/component-parameters.html

2) Have your component class extend Tapestry's "Any" component (http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/components/Any.html)

Upvotes: 3

Related Questions