protected function ParagraphsMigrateParagraphsFieldHandler::getRevisionIds in Paragraphs 7
Helper to get set of revision ids for import.
1 call to ParagraphsMigrateParagraphsFieldHandler::getRevisionIds()
File
- migrate/
fields/ ParagraphsMigrateParagraphsFieldHandler.inc, line 79
Class
- ParagraphsMigrateParagraphsFieldHandler
- Provides migrate field handler for paragraphs field.
Code
protected function getRevisionIds(array $values, array $arguments) {
$return = array();
if (!isset($arguments['revision_id'])) {
$arguments['revision_id'] = array();
}
elseif (!is_array($arguments['revision_id'])) {
$arguments['revision_id'] = array(
$arguments['revision_id'],
);
}
$revision_ids = db_select('paragraphs_item', 'p')
->fields('p', array(
'item_id',
'revision_id',
))
->condition('item_id', $values)
->execute()
->fetchAllKeyed();
foreach ($values as $delta => $item_id) {
// Get revision ID provided by the migration.
if (!empty($arguments['revision_id'][$delta])) {
$return[$delta] = $arguments['revision_id'][$delta];
}
else {
$return[$delta] = $revision_ids[$item_id];
}
}
return $return;
}