Disabled TestTagFieldPage and TestTag classes

Due to changed class parsing in 3.1, the class_exists() checks
are no longer recognized, leading to errors when the class
is only condtionally autoloaded (or the tagfield isn't present)
This commit is contained in:
Ingo Schommer 2013-04-30 00:53:22 +02:00
parent 752d38490b
commit 2ddb78e6f4
2 changed files with 56 additions and 60 deletions

View File

@ -1,25 +1,23 @@
<?php
if(class_exists('TagField')) {
class TestTag extends DataObject {
private static $db = array(
'Title' => 'Text'
);
private static $belongs_many_many = array(
'Pages' => 'TestTagFieldPage'
);
function requireDefaultRecords(){
$class = $this->class;
if(!DataObject::get_one($class)) {
foreach(array('one', 'two', 'three', 'four') as $title) {
$tag = new $class();
$tag->Title = $title;
$tag->write();
}
}
}
}
}
// class TestTag extends DataObject {
// private static $db = array(
// 'Title' => 'Text'
// );
// private static $belongs_many_many = array(
// 'Pages' => 'TestTagFieldPage'
// );
// function requireDefaultRecords(){
// $class = $this->class;
// if(!DataObject::get_one($class)) {
// foreach(array('one', 'two', 'three', 'four') as $title) {
// $tag = new $class();
// $tag->Title = $title;
// $tag->write();
// }
// }
// }
// }

View File

@ -1,42 +1,40 @@
<?php
if(class_exists('TagField')) {
class TestTagFieldPage extends Page {
// class TestTagFieldPage extends Page {
// private static $db = array(
// 'TestTagString' => 'Text',
// 'FixedTags' => 'Text'
// );
// private static $many_many = array(
// 'TestTags' => 'TestTag',
// );
// function getCMSFields() {
// $fields = parent::getCMSFields();
private static $db = array(
'TestTagString' => 'Text',
'FixedTags' => 'Text'
);
// $tf1 = new TagField('TestTagString', "Single column tags (try 'one', 'two', 'three', 'four')", null, 'TestTagFieldPage');
// $fields->addFieldToTab('Root.Main', $tf1);
private static $many_many = array(
'TestTags' => 'TestTag',
);
// $tf2 = new TagField('TestTags', "Relation tags (try 'one', 'two', 'three', 'four')");
// $fields->addFieldToTab('Root.Main', $tf2);
function getCMSFields() {
$fields = parent::getCMSFields();
$tf1 = new TagField('TestTagString', "Single column tags (try 'one', 'two', 'three', 'four')", null, 'TestTagFieldPage');
$fields->addFieldToTab('Root.Main', $tf1);
$tf2 = new TagField('TestTags', "Relation tags (try 'one', 'two', 'three', 'four')");
$fields->addFieldToTab('Root.Main', $tf2);
$tf3 = new TagField('FixedTags', "Fixed tags (try 'PHP', 'Ruby', 'Python')", null, 'TestTag');
$tf3->setCustomTags(array('PHP', 'Ruby', 'Python'));
$fields->addFieldToTab('Root.Main', $tf3);
return $fields;
}
// $tf3 = new TagField('FixedTags', "Fixed tags (try 'PHP', 'Ruby', 'Python')", null, 'TestTag');
// $tf3->setCustomTags(array('PHP', 'Ruby', 'Python'));
// $fields->addFieldToTab('Root.Main', $tf3);
function requireDefaultRecords(){
$class = $this->class;
if(!DataObject::get_one($class)) {
$page = new $class();
$page->Title = "Test TagField";
$page->write();
}
}
}
// return $fields;
// }
// function requireDefaultRecords(){
// $class = $this->class;
// if(!DataObject::get_one($class)) {
// $page = new $class();
// $page->Title = "Test TagField";
// $page->write();
// }
// }
// }
class TestTagFieldPage_Controller extends Page_Controller {}
}
// class TestTagFieldPage_Controller extends Page_Controller {}