Tuesday, November 29, 2011

Quick tip: easy writing of informative fields with ZedSeriesUi

The Data Container Array (a.k.a. dca) of Contao cms allows to define custom fields through the input_field_callback entry. A common usage scenario is providing informative contents to your users. This can be accomplished easily using the ZedSeriesUi class (that is included in ZedSeries Library for Contao cms).

Define your informative field as input_field_callback:

<?php

$GLOBALS['TL_DCA']['tl_dummy']['fields']['my_info_field'] = array(
'input_field_callback' => array('tl_dummy', 'myInfoField')
);

?>


Write your callback


<?php 

class tl_dummy {

public function myInfoField($dc) {
$ui = new ZedSeriesUi();
return $ui->ifcMessage('My content', 'zsui_info');
}

}

This will output a nice informative message



Feel free to comment below if you have further questions.

No comments:

Post a Comment