所說的「additionalFields」如果我得到你的問題,那麼你需要更多的領域獲得從後臺管理員的更多信息。
在extBase:
步驟1:附加字段插入擴展SQL文件
添加字段中ext_tables.sql文件,位於
YOUR_EXTENSION/ext_tables.sql
CREATE TABLE tx_YOUREXTENSION_domain_model_TABLENAME (
/**your existing fields... **/
newfield varchar(255) DEFAULT '' NOT NULL, // add new
);
第2步:比較數據庫和更新安裝工具
轉到後端>安裝工具>「與規格比較當前數據庫」 並進行更新。
第3步: TCA
YOUR_EXTENSION /配置/ TCA/Command.php
在
1. "showRecordFieldList" => "newfield"
2. "showitem" => "newfield"
陣列添加字段名稱現在你有到config你的領域:
'newfield' => array(
'exclude' => 1,
'label' => 'YOUR_LABLE',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'trim'
),
),
更多場配置,看到TCA Reference
步驟4:模型[獲取設定方法]
YOUR_EXTENSION /類別/域/型號/ Command.php
/**
* newfield
*
* @var string
*/
protected $newfield = '';
/**
* Returns the newfield
*
* @return string $newfield
*/
public function getNewfield() {
return $this->newfield;
}
/**
* Sets the newfield
*
* @param string $newfield
* @return void
*/
public function setNewfield($newfield) {
$this->newfield= $newfield;
}
步驟5:清除緩存
最後也是最重要的;)明確安裝工具緩存
也許這有助於(其德國不好意思):http://www.codesnip.de/snippets/beispiel-fuer-einen-commandcontroller.html – brandelizer
代碼格式化 – lalibi