Search code examples
phpexpressionengine

fieldtype tag pairs doens't work


I have set up my own fieldtype. Then in the template I do this

{exp:channel:entries entry_id="1"}
    {myfield}tag {ttt} contetnt{/myfield}
{/exp:channel:entries}

but it doesn't parse myfield. But if I do

{exp:channel:entries entry_id="1"}
    {myfield}
{/exp:channel:entries}

A PHP

function replace_tag($data, $params = array(), $tagdata = FALSE)
{
    $vars= array('ttt' => 'test');
    $tagdata = $this->EE->TMPL->parse_variables($tagdata, array($vars));

    return $tagdata;
}

All is fine. What do I do wrong?


Solution

  • If you want your fieldtype to act as a tag pair as well as a single tag you must add the following as a class variable:

    $has_array_data = TRUE