Given a list of items see what ones need to be inserted/updated or deleted.
Paramètres
array $items: Array of values, representing a row in the db.
Return value
array Nested array strucutre, index 0 is the insert update, 1 is the deleted.
1 call to advagg_critical_css_get_db_operations_arrays()
- advagg_critical_css_admin_settings_form_submit dans advagg_critical_css/
advagg_critical_css.admin.inc - Submit callback, process the advagg_critical_css form.
Fichier
-
advagg_critical_css/
advagg_critical_css.admin.inc, line 358
Code
function advagg_critical_css_get_db_operations_arrays(array $items, array $old_items) {
$insert_update = array();
$delete = array();
foreach ($items as $key => $values) {
// If the css is empty then this needs to be deleted.
if (empty($values['css'])) {
// Do not delete the new items entry (0); it's not in the db currently.
if (!empty($key)) {
$delete[$key] = $values;
}
}
else {
// Pass along the old key value pairs for db_merge.
if (!empty($old_items[$key])) {
$keys = $old_items[$key] + $values;
}
else {
$keys = $values;
}
$insert_update[$key] = array(
$keys,
$values,
);
}
}
return array(
$insert_update,
$delete,
);
}