Hide merge for empty parents

This commit is contained in:
Christopher Pitt 2015-04-23 16:43:19 +12:00
parent 48051024aa
commit c7b374f800

View File

@ -64,7 +64,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
* {@inheritdoc}
*/
public function getColumnContent($gridField, $record, $columnName) {
if($columnName === 'MergeAction') {
if($columnName === 'MergeAction' && $record->{$this->childMethod}()->Count() > 0) {
$dropdown = new DropdownField('Target', 'Target', $this->records->exclude('ID', $record->ID)->map());
$prefix = strtolower($this->parentMethod . '-' . $this->childMethod);