FOF30\Model\DataModel::getData PHP Method

getData() public method

Returns the data currently bound to the model in an array format. Similar to toArray() but returns a copy instead of the internal table itself.
public getData ( ) : array
return array
    public function getData()
    {
        $ret = array();
        foreach ($this->knownFields as $field => $info) {
            $ret[$field] = $this->getFieldValue($field);
        }
        return $ret;
    }

Usage Example

コード例 #1
0
ファイル: Text.php プロジェクト: akeeba/fof
 /**
  * Replace string with tags that reference fields
  *
  * @param   string  $text  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;
 }