ForumCategory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 39
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCMSFields_forPopup() 0 14 2
1
<?php
2
3
/**
4
 * A Forum Category is applied to each forum page in a has one relation.
5
 *
6
 * These will be editable via the {@link GridField} on the Forum object.
7
 *
8
 * @TODO replace StackableOrder with the SortableGridField module implementation.
9
 *
10
 * @package forum
11
 */
12
13
class ForumCategory extends DataObject
14
{
15
    
16
    private static $db = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
17
        'Title' => 'Varchar(100)',
18
        'StackableOrder' => 'Varchar(2)'
19
    );
20
    
21
    private static $has_one = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
22
        'ForumHolder' => 'ForumHolder'
23
    );
24
    
25
    private static $has_many = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
26
        'Forums' => 'Forum'
27
    );
28
        
29
    private static $default_sort = "\"StackableOrder\" DESC";
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
30
    
31
    /**
32
     * Get the fields for the category edit/ add
33
     * in the complex table field popup window.
34
     *
35
     * @return FieldList
36
     */
37
    public function getCMSFields_forPopup()
38
    {
39
        
40
        // stackable order is a bit of a workaround for sorting in complex table
41
        $values = array();
42
        for ($i = 1; $i<100; $i++) {
43
            $values[$i] = $i;
44
        }
45
46
        return new FieldList(
47
            new TextField('Title'),
48
            new DropdownField('StackableOrder', 'Select the Ordering (99 top of the page, 1 bottom)', $values)
49
        );
50
    }
51
}
52