Felder in Newsarchiv hinzufügen
Ich möchte einem Newsarchiv ein Set an Feldern hinzufügen und habe dazu schon das Forum durchforstet.
Die Datenfelder wurden in der Datenbank ergänzt. Mit dem umgeschriebenen Contao Beispiel für die Mitgliedsliste hatte es irgendwie funktioniert,
aber nun sehe ich im Archiv keine neuen Felder.
/modules/z_news/dca/tl_news.php
PHP-Code:
<?php
array_insert($GLOBALS['TL_DCA']['tl_news'], 1, array
(
// Config
'config' => array
(
'onload_callback' => array(
array('sociallinks', 'methode')
)
)
));
class sociallinks extends Backend
{
public function methode(Datacontainer $dc)
{
$objNews = \NewsModel::findById(\Input::get(id));
if ($objNews->pid != '4') {
$GLOBALS['TL_DCA']['tl_news']['palettes']['__selector__'][] = 'addSocial';
$GLOBALS['TL_DCA']['tl_news']['palettes']['default'] .= ';{social_legend},addSocial';
$GLOBALS['TL_DCA']['tl_news']['subpalettes']['addSocial'] = 'Social';
$GLOBALS['TL_DCA']['tl_news']['fields']['social_facebook'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_news']['social_facebook'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'rgxp'=>'url', 'maxlength'=>256),
'sql' => "varchar(265) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_news']['fields']['social_lin'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_news']['social_lin'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'rgxp'=>'url', 'maxlength'=>256),
'sql' => "varchar(265) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_news']['fields']['social_instagram'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_news']['social_instagram'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'rgxp'=>'url', 'maxlength'=>256),
'sql' => "varchar(265) NOT NULL default ''"
);
$GLOBALS['TL_DCA']['tl_news']['fields']['social_twitter'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_news']['social_twitter'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('mandatory'=>false, 'rgxp'=>'url', 'maxlength'=>256),
'sql' => "varchar(265) NOT NULL default ''"
);
}
}
}
Die Übersetzung ist vorhanden.
/modules/z_news/languages/de/tl_news.php
PHP-Code:
<?php
$GLOBALS['TL_LANG']['tl_news']['social_legend'] = 'Social Links';
$GLOBALS['TL_LANG']['tl_news']['social_facebook'] = 'Facebook';
$GLOBALS['TL_LANG']['tl_news']['social_lin'] = 'LinkedIn';
$GLOBALS['TL_LANG']['tl_news']['social_instagram'] = 'Instagram';
$GLOBALS['TL_LANG']['tl_news']['social_twitter'] = 'Twitter';
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,
ich möchte auch ein eigenes Feld (newsMedium), das auf der ersten Eben der News liegt und das im Backend über das eigene Modul geliefert wird, in der Newliste eines Newsarchives vor bzw. zusammen mit dem Newstitel anzeigen lassen. Ich gehe davon aus, dass ich tl_news_archive zusätzlich anlegen muss.
Was muss ich da eintragen? So etwas? Siehe Bild, wo ich das haben möchte. Anhang 19971
PHP-Code:
$GLOBALS['TL_DCA']['tl_news_archive']['palettes']['__selector__'][] = 'newsMedium';
$GLOBALS['TL_DCA']['tl_news_archive']['palettes']['default'] .= 'newsMedium';
$GLOBALS['TL_DCA']['tl_news_archive']['palettes']['default'] = str_replace("title", "newsMedium,title,", $GLOBALS['TL_DCA']['tl_news']['palettes']['default']);
Für jeden Ratschlag wäre ich euch sehr dankbar.
Liebe Grüße,
Jan