| Conditions | 3 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 1 | public function getCMSFields() |
|
| 34 | { |
||
| 35 | 1 | $fields = parent::getCMSFields(); |
|
| 36 | |||
| 37 | 1 | $fields->removeByName(array( |
|
| 38 | 1 | 'SortOrder', |
|
| 39 | 1 | 'Panels', |
|
| 40 | 1 | )); |
|
| 41 | |||
| 42 | 1 | $config = GridFieldConfig_RecordEditor::create(); |
|
| 43 | 1 | if (class_exists('GridFieldOrderableRows')) { |
|
| 44 | 1 | $config->addComponent(new GridFieldOrderableRows()); |
|
| 45 | 1 | } |
|
| 46 | 1 | $config->removeComponentsByType('GridFieldAddExistingAutocompleter'); |
|
| 47 | 1 | $config->removeComponentsByType('GridFieldDeleteAction'); |
|
| 48 | 1 | $config->addComponent(new GridFieldDeleteAction(false)); |
|
| 49 | |||
| 50 | 1 | if ($this->ID) { |
|
| 51 | 1 | $fields->addFieldsToTab('Root.Panels', array( |
|
| 52 | 1 | GridField::create('Panels', 'Accordion Panels', $this->Panels()->sort('Sort'), $config), |
|
|
|
|||
| 53 | 1 | )); |
|
| 54 | 1 | } |
|
| 55 | |||
| 56 | 1 | return $fields; |
|
| 57 | } |
||
| 58 | } |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: