Code:
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
$GLOBALS['TL_DCA']['tl_recommended_procedures'] = array
(
// Config
'config' => array
(
'dataContainer' => 'Memory',
'closed' => true,
'onload_callback' => array(
array('tl_recommended_procedures', 'onload_callback'),
),
'onsubmit_callback' => array(
array('tl_recommended_procedures', 'onsubmit_callback'),
),
),
// List
'list' => array
(
'sorting' => array
(
'mode' => 2,
'fields' => array('title'),
'flag' => 1,
'panelLayout' => 'sort,search,limit'
),
'label' => array(
'fields' => array('title'),
'format' => '%s',
),
'global_operations' => array
(
'all' => array
(
'label' => 'all',
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"'
)
),
'operations' => array
(
'edit' => array
(
'label' => 'edit',
'href' => 'table=tl_recommended_procedures',
'icon' => 'edit.gif'
),
'copy' => array
(
'label' => 'copy',
'href' => 'act=copy',
'icon' => 'copy.gif'
),
'delete' => array
(
'label' => 'delete',
'href' => 'act=delete',
'icon' => 'delete.gif'
),
'show' => array
(
'label' => 'show',
'href' => 'act=show',
'icon' => 'show.gif'
)
)
),
// Fields
'fields' => array
(
'sId' => array
(
'label' => array('sId'),
'inputType' => 'text',
'search' => true
),
'title' => array
(
'label' => 'title',
'exclude' => true,
'inputType' => 'text',
'search' => true,
'eval' => array('mandatory'=>true, 'maxlength'=>255, 'decodeEntities'=>true)
),
),
);
class tl_recommended_procedures extends Backend
{
/**
* __construct
*/
public function __construct()
{
parent::__construct();
$this->import('Input');
$this->import('BackendUser', 'User');
$this->import('Database');
}
/**
*
*/
public function onload_callback(DataContainer $dc)
{
$arrData = array(
array(
'sId' => 0,
'title' => 'title_0'
),
array(
'sId' => 1,
'title' => 'title_1'
),
);
$dc->setDataArray($arrData);
}
}
Jedoch, wenn ich die entsprechende Seite im Backend aufrufe, werden die Daten nicht gerendert, sondern eine "leere" Ansicht generiert. Den Screenshot habe ich diesem Post beigefügt.
Lesezeichen