Closed matthewjohns0n closed 7 years ago
Just discovered, same is going to go for Assets and Ansel support in grid:
if ($assets && $assets->isInstalled()) {
$assets_selections = ee()->db->query('SELECT * FROM exp_assets_selections WHERE entry_id = '.$data['entry_id'].' AND content_type = "grid" AND row_id ='.$save_row_id);
if ($assets_selections->num_rows != 0){
$all_assets = $assets_selections->result();
foreach($all_assets as $kee => $vals){
$prop = get_object_vars($vals);
$prop['entry_id'] = $entry_id_of_duplicate;
$prop['row_id'] = $new_row_id;
ee()->db->insert('assets_selections', $prop);
}
}
}
// Ansel support
if ($ansel && $ansel->isInstalled()) {
$ansel_images = ee()->db->query('SELECT * FROM exp_ansel_images WHERE content_id = '.$data['entry_id'].' AND content_type = "grid" AND row_id ='.$save_row_id);
$this->duplicate_ansel($ansel_images, $entry_id_of_duplicate, $new_row_id);
}
Thanks TJ, good catch. I added those checks in.
Hi guys. Thanks for your contributions. I will review this tomorrow and hopefully should be good to merge.
If I may butt in here. This PR assumes Ansel is installed. If Ansel is not installed, EE throws a big fit about trying to select from a table that does not exist.
It also assumes Assets is installed (added prior to this PR).
The fix is as follows:
Down on line 283 of ext.simple_cloner.php, change the Ansel support to the following.
And the same business for assets support right under.
I’d make these changes and submit to the PR myself but I don’t think I, as a third party, can modify or add to an open PR? Or maybe I don’t know how to do it.