protected function parseFieldTags($text)
{
$ret = $text;
// Replace [ITEM:ID] in the URL with the item's key value (usually:
// the auto-incrementing numeric ID)
if (is_null($this->item)) {
$this->item = $this->form->getModel();
}
$replace = $this->item->getId();
$ret = str_replace('[ITEM:ID]', $replace, $ret);
// Replace the [ITEMID] in the URL with the current Itemid parameter
$ret = str_replace('[ITEMID]', $this->form->getContainer()->input->getInt('Itemid', 0), $ret);
// Replace the [TOKEN] in the URL with the Joomla! form token
$ret = str_replace('[TOKEN]', \JFactory::getSession()->getFormToken(), $ret);
// Replace the [RELATION:ID] in the URL with the relation's key value
$ret = str_replace('[RELATION:ID]', $this->_relationId, $ret);
// Replace other field variables in the URL
$data = $this->item->getData();
foreach ($data as $field => $value) {
// Skip non-processable values
if (is_array($value) || is_object($value)) {
continue;
}
$search = '[ITEM:' . strtoupper($field) . ']';
$ret = str_replace($search, $value, $ret);
}
return $ret;
}