FOF30\Model\DataModel::getKeyName PHP Method

getKeyName() public method

Alias of getIdFieldName. Used for JTableInterface compatibility.
public getKeyName ( ) : string
return string The name of the primary key for the table.
    public function getKeyName()
    {
        return $this->getIdFieldName();
    }

Usage Example

コード例 #1
0
ファイル: GenericList.php プロジェクト: Joal01/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)
     $keyfield = $this->item->getKeyName();
     $replace = $this->item->{$keyfield};
     $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 other field variables in the URL
     $fields = $this->item->getTableFields();
     foreach ($fields as $fielddata) {
         $fieldname = $fielddata->Field;
         if (empty($fieldname)) {
             $fieldname = $fielddata->column_name;
         }
         $search = '[ITEM:' . strtoupper($fieldname) . ']';
         $replace = $this->item->{$fieldname};
         if (!is_string($replace)) {
             continue;
         }
         $ret = str_replace($search, $replace, $ret);
     }
     return $ret;
 }
All Usage Examples Of FOF30\Model\DataModel::getKeyName