The property $icon is not used and could be removed.
This check marks private properties in classes that are never used. Those properties can be removed.
Loading history...
15
16
public static $allowed_children = array('Staff');
17
18
public function getCMSFields()
19
{
20
$fields = parent::getCMSFields();
21
$fields->addFieldToTab('Root.Image', new UploadField('MainImage'));
22
$fields->addFieldToTab('Root.Layout', new CheckboxField('LinkToIndividualStaffPages', 'If biographies are short, leave this as false to only show a single page of staff'));
23
24
return $fields;
25
}
26
27
public function getPortletTitle()
28
{
29
return $this->Title;
30
}
31
32
// FIXME - make this more efficient
33
public function getPortletImage()
34
{
35
return $this->MainImage();
36
}
37
38
public function getPortletCaption()
39
{
40
return '';
41
}
42
}
43
44
class StaffFolder_Controller extends Page_Controller
PSR1 recommends that each class should be in its own file to aid autoloaders.
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.
In camelCase names are written without any punctuation, the start of each new word
being marked by a capital letter. The whole name starts with a capital letter as well.
Thus the name database provider becomes DatabaseProvider.
StaffFolderCacheKey uses the super-global variable $_GET which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies
of your class. This makes your code less dependent on global state and it
becomes generally more testable:
// BadclassRouter{publicfunctiongenerate($path){return$_SERVER['HOST'].$path;}}// BetterclassRouter{private$host;publicfunction__construct($host){$this->host=$host;}publicfunctiongenerate($path){return$this->host.$path;}}classController{publicfunctionmyAction(Request$request){// Instead of$page=isset($_GET['page'])?intval($_GET['page']):1;// Better (assuming you use the Symfony2 request)$page=$request->query->get('page',1);}}
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.