16/10/2013 1:19am

PHP | Problem -


<?php


/****************************************************************
* *
* ESTABLISH PARAMETERS FOR EACH NEWS CATEGORY *
* *
*****************************************************************/

class NewsCategory extends DataObject {


public static $db = array(
'SortOrder' => 'Int',
'Title' => 'Varchar'
);

//One-to-one relationship with gallery page
public static $has_one = array('News' => 'News');

//Tidy up CMS by removing the fields we don't want users to modify.
public function getCMSFields() {
$fields = parent::getCMSFields();

$fields->removeFieldFromTab("Root.Main","NewsID");
$fields->addFieldToTab("Root.Main", new TextField("Title", "Category Name"));

$fields->removeFieldFromTab("Root.Main","NewsID");
$fields->removeFieldFromTab("Root.Main","SortOrder");
return $fields;
}

// Tell the datagrid what fields to show in the table
public static $summary_fields = array('ID' => 'ID', 'Title' => 'Title');

}


Post Comment