コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     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($gridField, 'MergeAction' . $record->ID, 'Move', 'merge', array('record' => $record->ID, 'target' => $prefix . '-target-record-' . $record->ID));
         $action->setExtraAttributes(array('data-target' => $prefix . '-target-record-' . $record->ID));
         return $dropdown->Field() . $action->Field() . '<a title="Move posts to" class="MergeActionReveal">move posts to</a>';
     }
     return null;
 }