public function testGetDescendantsOf() { $expect = array('SILVERSTRIPE\\TEST\\CLASSA' => array('silverstripe\\test\\ClassB', 'silverstripe\\test\\ClassH'), 'silverstripe\\test\\classa' => array('silverstripe\\test\\ClassB', 'silverstripe\\test\\ClassH')); foreach ($expect as $class => $desc) { $this->assertEquals($desc, $this->manifest->getDescendantsOf($class)); } }
/** * manipulates the cms fields * * @param FieldList $fields cms fields * * @return void * * @author Patrick Schneider <*****@*****.**> * @since 04.01.2013 */ public function updateCMSFields(FieldList $fields) { if (!$this->owner->isInDB()) { $manifest = new SS_ClassManifest(BASE_PATH); $descendants = $manifest->getDescendantsOf('Widget'); $descendants = array_flip($descendants); foreach (self::$hiddenWidgets as $className) { unset($descendants[$className]); } foreach ($descendants as $descendant => $index) { $descendants[$descendant] = _t($descendant . '.TITLE', $descendant); } $fields->push(new DropdownField('ClassName', _t('WidgetSetWidget.TYPE'), $descendants)); } }