[eluser]Donald Hughes[/eluser]
It's a really basic form. I just needed to be able to add custom validators.
news.php
Code:
class News extends codexController
{
function News ()
{
// Load the CodexController
codexController::codexController();
$rules['title'] = "trim|required";
$rules['info_plain_text'] = "trim|required";
$rules['start_publish_date'] = "required";
$rules['end_publish_date'] = "required|callback_end_publish_date_check";
$rules['end_date'] = "callback_end_date_check";
$config = array(
'db_table' => 'news', //The name of the table associated with this controller
'form_setup' => $this->spyc->YAMLLOAD($this->codexadmin->getDefinitionFileName('news')), //The array that holds our elements
'controller_name' => 'News', //The name of the controller, so that it can be used when generating the URLs
'primary_key' => 'id', //The name of the controller, so that it can be used when generating the URLs
'display_fields'=>array('title','start_date','end_date','start_publish_date','end_publish_date','info_plain_text','info_rich_text'),
'rules'=>$rules
);
$this->setConfig($config);
}
news.yml:
Code:
title:
class: TextBox
start_date:
class: Date
end_date:
class: Date
start_publish_date:
class: Date
end_publish_date:
class: Date
info_plain_text:
class: TextArea
attributes:
cols:70
rows:12
info_rich_text:
class: Editor
attributes:
cols:70
rows:12