TYPO3のTCA - すべてのインターフェイスオプションを指定せずに「インライン」タイプを使用する方法
質問
私は現在t3blog拡張子を使用するプロジェクトに取り組んでいます。バックエンドで新しい投稿を作成するときに、あなたは最初のタイトルを入力して、あなたはポストにコンテンツを追加するために「新しい作成」をクリックする必要があります。
理想的には、クライアントは、「新規作成」か、少なくともそれは、デフォルトでは、コンテンツの新しい作品を作成してもらう削除したいと考えています。
私は拡張子のTCAを掘りだし、それがそのコントロールを追加どこが見つかりました、今私は私が前にTCAにハッキングされていないとして立ち往生少しだけど、誰もが」の動作を変更する方法を知っているんTCA経由インライン」タイプ?
ここでコントロールを追加するコードです。
'content' => Array (
'exclude' => 1,
'label' => 'LLL:EXT:t3blog/locallang_db.xml:tx_t3blog_post.content',
'config' => array (
'type' => 'inline',
'foreign_table' => 'tt_content',
'foreign_field' => 'irre_parentid',
'foreign_table_field' => 'irre_parenttable',
'maxitems' => 100,
'appearance' => array(
'showSynchronizationLink' => 0,
'showAllLocalizationLink' => 0,
'showPossibleLocalizationRecords' => 0,
'showRemovedLocalizationRecords' => 0,
'expandSingle' => 1
),
'behaviour' => array(
),
)
),
私は何をしようとしていることは作成され、「一般」タブを削除し、ちょうど「テキスト」タブを持つことです。
任意のヒントは非常に高く評価されるだろう。
解決 2
ただ、ヘッド傷の長いセッションの後、この昨日の問題を解決するために管理し、ここではどのようにされます:
これにTCAを修正します:
'content' => Array (
'exclude' => 1,
'label' => 'LLL:EXT:t3blog/locallang_db.xml:tx_t3blog_post.content',
'config' => array (
'type' => 'inline',
'foreign_table' => 'tt_content',
'foreign_field' => 'irre_parentid',
'foreign_table_field' => 'irre_parenttable',
'maxitems' => 100,
'appearance' => array(
'showSynchronizationLink' => 0,
'showAllLocalizationLink' => 0,
'showPossibleLocalizationRecords' => 0,
'showRemovedLocalizationRecords' => 0,
'expandSingle' => 1,
'collapseAll' => 0
),
'behaviour' => array(
),
't3blog' => true
)
)
それから私は、新しい空の拡張機能を作成しました。 extディレクトリ内には、次の内容のext_tables.php作成します:
<?php
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tceforms_inline.php'] = t3lib_extMgm::extPath($_EXTKEY).'ux_inline.php';
そしてux_inline.php内部ます:
<?php
class ux_t3lib_TCEforms_inline extends t3lib_TCEforms_inline
{
public function renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord = false)
{
if(isset($config['t3blog']) && $config['t3blog'])
{
$GLOBALS['TCA']['tt_content']['types']['text']['showitem'] = 'bodytext;;9;richtext:rte_transform[flag=rte_enabled|mode=ts_css];3-3-3';
$GLOBALS['TCA']['tt_content']['columns']['CType']['exclude'] = 1;
$GLOBALS['TCA']['tt_content']['columns']['header']['exclude'] = 1;
return;
}
else
{
return parent::renderForeignRecordHeader($parentUid, $foreign_table, $rec, $config, $isVirtualRecord);
}
}
public function getExpandedCollapsedState($table, $uid)
{
if(isset($_REQUEST['edit']['tx_t3blog_post']))
return true;
else
return parent::getExpandedCollapsedState($table, $uid);
}
public function getLevelInteractionLink($type, $objectPrefix, $conf=array())
{
if(!isset($conf['t3blog']) || !$conf['t3blog'])
{
return parent::getLevelInteractionLink($type, $objectPrefix, $conf);
}
else
{
if((int) $conf['inline']['first'] > 0)
return;
}
$nameObject = $this->inlineNames['object'];
$attributes = array();
switch($type) {
case 'newRecord':
$title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:cm.createnew', 1);
$iconFile = 'gfx/new_el.gif';
// $iconAddon = 'width="11" height="12"';
$className = 'typo3-newRecordLink';
$attributes['class'] = 'inlineNewButton '.$this->inlineData['config'][$nameObject]['md5'];
$attributes['onclick'] = "return inline.createNewRecord('$objectPrefix')";
$attributes['style'] = "display: none;";
if (isset($conf['inline']['inlineNewButtonStyle']) && $conf['inline']['inlineNewButtonStyle']) {
$attributes['style'] = $conf['inline']['inlineNewButtonStyle'];
}
if (isset($conf['appearance']['newRecordLinkAddTitle']) && $conf['appearance']['newRecordLinkAddTitle']) {
$titleAddon = ' '.$GLOBALS['LANG']->sL($GLOBALS['TCA'][$conf['foreign_table']]['ctrl']['title'], 1);
}
$icon = ($iconFile ? '<img'.t3lib_iconWorks::skinImg($this->backPath, $iconFile, $iconAddon).' alt="'.htmlspecialchars($title.$titleAddon).'" />' : '');
$link = $this->wrapWithAnchor($icon.$title.$titleAddon, '#', $attributes);
return '<div'.($className ? ' class="'.$className.'"' : '').'>'.$link.'</div>';
break;
case 'localize':
$title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:localizeAllRecords', 1);
$iconFile = 'gfx/localize_el.gif';
$className = 'typo3-localizationLink';
$attributes['onclick'] = "return inline.synchronizeLocalizeRecords('$objectPrefix', 'localize')";
break;
case 'synchronize':
$title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:synchronizeWithOriginalLanguage', 1);
$iconFile = 'gfx/synchronize_el.gif';
$className = 'typo3-synchronizationLink';
$attributes['class'] = 'inlineNewButton '.$this->inlineData['config'][$nameObject]['md5'];
$attributes['onclick'] = "return inline.synchronizeLocalizeRecords('$objectPrefix', 'synchronize')";
break;
}
// Create the link:
}
}
が、これは将来的に他の誰かを助けることを願っています。
他のヒント
私の理解では、その型は「インライン」「 IRRE の」またはインラインリレーショナル・レコードと呼ばれるものを指し、 TCAでの編集、(TYPO3の基準で)比較的新しいと強力なデータ構造。あなたはこのセクションを見つけるかもしれませんリファレンスとして有用なTYPO3のコアAPI のドキュメントの。
そのまま、クリックすると、バックグラウンドで新しいデータベースレコードを作成するためのAjax呼び出しを行います。しかし、私は(これなどのPowerMailなど他のプラグインを使用して)見てきたものから、私はT3コア自体を拡張/いくつかの深刻なハッキングを行うことなく、余分なクリックをスキップする方法がある疑い。申し訳ありませんが、私はより多くの助けになる、そしてちょうど最近、この出くわしたことができない、自分自身。うまくいけば、これを試してみましたSO上の他のTYPO3のハッカーがあります...