Merge pull request #201 from assertchris/hide-merge-for-empty-parents

Hide merge for empty parents
This commit is contained in:
Damian Mooyman 2015-04-24 10:03:49 +12:00
commit 40b05482a8
1 changed files with 2 additions and 2 deletions

View File

@ -64,9 +64,9 @@ 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);
$action = GridFieldFormAction::create(