/** * Perform the create action on a record that is new. * * @param array $selectedKey the selected keys * @param array $selectedRecord the selected record * @param array $ownerRecord the owner record * @param int $index the index of the item in the set * * @return array the newly created record */ protected function _createRecord($selectedKey, $selectedRecord, $ownerRecord, $index) { $record = parent::_createRecord($selectedKey, $selectedRecord, $ownerRecord, $index); if ($this->hasPositionAttribute()) { $record[$this->getPositionAttribute()] = $index + 1; } return $record; }