Conditions | 3 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public function getCMSFields() |
||
16 | { |
||
17 | $fields = parent::getCMSFields(); |
||
18 | |||
19 | if ($relations = ClassInfo::subclassesFor('ProductDoc')) { |
||
20 | unset($relations['ProductDoc']); |
||
21 | foreach ($relations as $key => $value) { |
||
22 | $relations[$key] = singleton($value)->i18n_singular_name(); |
||
23 | } |
||
24 | |||
25 | $fields->addFieldToTab( |
||
26 | 'Root.Main', |
||
27 | DropdownField::create('ManagedClass', 'Files to display', $relations) |
||
28 | ->setEmptyString(''), |
||
29 | 'Content' |
||
30 | ); |
||
31 | } |
||
32 | |||
33 | return $fields; |
||
34 | } |
||
35 | } |
||
40 | } |
Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.