FOF30\Form\Field\GenericList::parseFieldTags PHP Method

parseFieldTags() protected method

Replace string with tags that reference fields
protected parseFieldTags ( string $text ) : string
$text string Text to process
return string Text with tags replace
    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 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;
    }