Skip to content

Commit a6b3470

Browse files
committed
Disabled delete based on preset
1 parent 2473b21 commit a6b3470

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

code/models/Section.php

+11
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ public function canEdit($member = null) {
181181
* @return boolean
182182
*/
183183
public function canDelete($member = null) {
184+
if ($this->UniqueConfigTitle){
185+
return false;
186+
}
184187
return Permission::check('DELETE_SECTIONS', 'any', $member);
185188
}
186189

@@ -265,4 +268,12 @@ public function Layout()
265268
return $this->renderWith($this->Render());
266269
}
267270
}
271+
272+
public function GridFieldRowClasses(){
273+
if ($this->UniqueConfigTitle){
274+
return array('preset');
275+
}
276+
return array();
277+
278+
}
268279
}

code/sections/MainSection.php

-4
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,4 @@ public function Layout()
4747
return $page->renderWith($this->Render());
4848
}
4949
}
50-
51-
public function GridFieldRowClasses(){
52-
return array('disabled', 'main');
53-
}
5450
}

css/CMSMain.GridField.css

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.ss-gridfield-item.disabled td:not(.col-reorder){
2-
color: #aaa;
3-
}
4-
5-
.ss-gridfield-item.disabled .col-buttons .action{
1+
.ss-gridfield-item.preset .col-buttons .action{
62
display: none!important;
73
}

0 commit comments

Comments
 (0)