function inline_conditions_field_prepare_items in Inline Conditions 7
Alter $items array and prepare it to be saved.
Serialize the condition_settings column.
Parameters
array $items: A referenced array of field items.
See also
inline_conditions_field_load()
inline_conditions_field_insert()
2 calls to inline_conditions_field_prepare_items()
- inline_conditions_field_insert in ./
inline_conditions.field.inc - Implements hook_field_insert().
- inline_conditions_field_update in ./
inline_conditions.field.inc - Implements hook_field_update().
File
- ./
inline_conditions.field.inc, line 125 - Field module functionality for the Inline Conditions module.
Code
function inline_conditions_field_prepare_items(&$items) {
// A simple way to check if array is a multi-dimensional array.
if (is_array($items)) {
foreach ($items as $delta => $item) {
// Ensures that $item has a condition name.
if (!empty($item['condition_name'])) {
// Ensure that condition_settings is not serialized.
if (is_array($item['condition_settings'])) {
$condition_settings = array_merge($item['condition_settings'], array(
// Store the rule condition logic operators.
'condition_negate' => isset($item['condition_negate']) ? $item['condition_negate'] : NULL,
'condition_logic_operator' => isset($item['condition_logic_operator']) ? $item['condition_logic_operator'] : NULL,
));
$item['condition_settings'] = serialize($condition_settings);
}
// Replace item value.
$items[$delta] = $item;
}
}
}
}