Contao 3.0.5: DCA - Callbacks in eigenen Feldern
Hey,
wie man hier https://community.contao.org/de/show...l=1#post257290 lesen kann, stehe ich gerade vor dem Problem, dass in der Erweiterung taxonomy_content unter Contao 3 ein Save Callback nicht ausgeführt wird. Ich weiß, dass die Erweiterung für Contao 3 nicht freigegeben ist, aber: Es scheint mir ein generelles Problem zu sein. Ich habe zum Beispiel einfach mal in die DCA-Datei tl_page.php hart ein eigens Feld integriert und versucht dafür einen save_callback aufzurufen: tuts auch nicht! Es scheint mir als würden non-Core Callbacks einfach ignoriert? Hat sich da in Contao 3 irgendwas in der Deklaration geändert? Ich konnte auch nach langem Suchen hier im Forum nichts finden.
Ich poste gerade mal den Code aus der DCA-Datei, vielleicht bin ich ja auch nur schrecklich blind:
Code:
<?php
/**
* Contao Extension taxonomy_content
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* @copyright toxA IT-Dienstleistungen, 2011
* @author Thomas Urban <http://www.toxa.de>
* @package Backend
* @license LGPL
*/
foreach ( $GLOBALS['TL_DCA']['tl_page']['palettes'] as $key => $palette )
if ( is_string( $palette ) )
$GLOBALS['TL_DCA']['tl_page']['palettes'][$key] = str_replace( '{protected_legend:hide}', '{taxonomy_legend:hide},taxonomy;{protected_legend:hide}', $palette );
$GLOBALS['TL_DCA']['tl_page']['fields']['taxonomy'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_page']['taxonomy'],
'inputType' => 'taxonomyTree',
'exclude' => true,
'eval' => array( 'fieldType' => 'checkbox' ),
'save_callback' => array(array('tl_taxonomy_content_page','save_taxonomies'))
);
class tl_taxonomy_content_page extends Backend
{
/**
* Initialize the object
*/
public function __construct()
{
parent::__construct();
$this->import('BackendUser', 'User');
}
/**
* Instance of this extension's utility class
*
* @var TaxonomyContent
*/
protected $Taxonomy;
public function save_taxonomies($varValue, DataContainer $dc)
{
echo 'Stop';
die;
$this->import( 'TaxonomyContent', 'Taxonomy' );
$this->Taxonomy->assignTaxonomies( TaxonomyContent::PAGES, $dc->id, @unserialize( $varValue ) );
return $varValue;
}
}
Ich habe da schon ein bisschen dran rum gebastelt: Variablen umbenannt $value -> $varValue und $dca -> DataContainer $dc, hat alles nichts getan. Eigentlich sollte er doch beim Speichern einfach "Stop" echoen und dann sterben. Tut er z.B. auch, wenn ich in den Save Callback der core tl_page in der generateAlias Funktion
einbaue.
Dank!