These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | |||
4 | class ContactListPage extends Page |
||
0 ignored issues
–
show
|
|||
5 | { |
||
6 | private static $icon = 'contact_list/images/treeicons/ContactListPage'; |
||
0 ignored issues
–
show
|
|||
7 | |||
8 | /** |
||
9 | * @var String Description of the class functionality, typically shown to a user |
||
10 | * when selecting which page type to create. Translated through {@link provideI18nEntities()}. |
||
11 | */ |
||
12 | private static $description = "Shows a list of contacts"; |
||
0 ignored issues
–
show
|
|||
13 | |||
14 | /** |
||
15 | * standard SS variable |
||
16 | * @Var String |
||
17 | */ |
||
18 | private static $singular_name = 'Contact List Page'; |
||
0 ignored issues
–
show
|
|||
19 | |||
20 | public function i18n_singular_name() |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a
Loading history...
|
|||
21 | { |
||
22 | return $this->Config()->get('singular_name'); |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * standard SS variable |
||
27 | * @Var String |
||
28 | */ |
||
29 | private static $plural_name = 'Contact List Pages'; |
||
0 ignored issues
–
show
|
|||
30 | |||
31 | public function i18n_plural_name() |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a
Loading history...
|
|||
32 | { |
||
33 | return $this->Config()->get('plural_name'); |
||
34 | } |
||
35 | |||
36 | public function canCreate($member = null) |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a
Loading history...
|
|||
37 | { |
||
38 | if (ContactListPage::get()->count() == 0) { |
||
39 | return parent::canCreate($member); |
||
40 | } |
||
41 | return false; |
||
42 | } |
||
43 | |||
44 | private static $contacts_list_cache_key = null; |
||
45 | |||
46 | public function ContactsListCacheKey() |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a
Loading history...
|
|||
47 | { |
||
48 | if (!self::$contacts_list_cache_key) { |
||
49 | self::$contacts_list_cache_key = "CL_".Contact::get()->max('LastEdited') . "_" . Contact::get()->count(); |
||
50 | } |
||
51 | return self::$contacts_list_cache_key; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * CMS Fields |
||
56 | * @return FieldList |
||
57 | */ |
||
58 | public function getCMSFields() |
||
59 | { |
||
60 | $fields = parent::getCMSFields(); |
||
61 | $fields->addFieldsToTab( |
||
62 | 'Root.Contacts', |
||
63 | GridField::create( |
||
64 | 'Contacts', |
||
65 | 'Contacts', |
||
66 | Contact::get(), |
||
67 | GridFieldConfig_RecordEditor::create() |
||
68 | ) |
||
69 | ); |
||
70 | return $fields; |
||
71 | } |
||
72 | |||
73 | } |
||
74 | |||
75 | class ContactListPage_Controller extends Page_Controller |
||
0 ignored issues
–
show
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.
You can fix this by adding a namespace to your class: namespace YourVendor;
class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
Loading history...
|
|||
76 | { |
||
77 | public function init() |
||
78 | { |
||
79 | parent::init(); |
||
80 | TableFilterSortAPI::include_requirements( |
||
81 | $tableSelector = '.tfs-holder', |
||
82 | $blockArray = array('TableFilterSort.theme'), |
||
83 | $jqueryLocation = '', |
||
84 | $includeInPage = true, |
||
85 | $jsSettings = '{serverConnectionURL: ""}' |
||
86 | ); |
||
87 | } |
||
88 | |||
89 | public function Contacts() |
||
90 | { |
||
91 | return Contact::get()->filter(array('IsVisible' => 1)); |
||
92 | } |
||
93 | } |
||
94 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.