- Timestamp:
- 12/10/08 07:46:56 (7 weeks ago)
- Files:
-
- 1 modified
-
modules/tagfield/trunk/code/TagField.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
modules/tagfield/trunk/code/TagField.php
r63923 r64095 9 9 * - Autosuggest functionality (currently JSON only) 10 10 * 11 * Example Datamodel and Instanciation: 12 * <code> 13 * class Article extends DataObject { 14 * static $many_many = array('Tags'=>'Tag'); 15 * } 16 * class Tag extends DataObject { 17 * static $db = array('Title'=>'Varchar'); 18 * static $belongs_many_many = array('Articles'=>'Article'); 19 * } 20 * </code> 21 * <code> 22 * $form = new Form($this,'Form', 23 * new FieldSet( 24 * new TagField('Tags', 'My Tags', null, 'Article') 25 * ) 26 * new FieldSet() 27 * ); 28 * $form->loadDataFrom($myArticle); 29 * $form->saveInto($myArticle); 30 * </code> 31 * 11 32 * @author Ingo Schommer, SilverStripe Ltd. (<firstname>@silverstripe.com) 12 33 * @package formfields … … 53 74 protected $customTags; 54 75 55 function __construct($name, $title = null, $value = null, $tagTopicClass ) {76 function __construct($name, $title = null, $value = null, $tagTopicClass = null) { 56 77 $this->tagTopicClass = $tagTopicClass; 57 78 … … 129 150 } 130 151 152 /** 153 * @param string $class Classname of the DataObject which contains 154 * the relation or field for tags. 155 */ 156 public function setTagTopicClass($class) { 157 $this->tagTopicClass = $class; 158 } 159 160 /** 161 * @return string Classname 162 */ 163 public function getTagTopicClass() { 164 return $this->tagTopicClass; 165 } 166 131 167 protected function saveIntoObjectTags($record) { 132 168 // HACK We can't save relationship tables without having an ID
