summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitai Burstein2013-04-14 17:57:04 (GMT)
committer Amitai Burstein2013-04-14 17:57:04 (GMT)
commit146c0ac642f1bbe51b1f80fe83903ce72eda96ed (patch)
tree1a7e6f43e790059964eff4ff000720a10e7714eb
parent1fb7fdce7542d1764c45d1cb676c3e79117b8e13 (diff)
Fix disable,
-rw-r--r--entityreference_prepopulate.module16
1 files changed, 6 insertions, 10 deletions
diff --git a/entityreference_prepopulate.module b/entityreference_prepopulate.module
index 3c326e1..f005a41 100644
--- a/entityreference_prepopulate.module
+++ b/entityreference_prepopulate.module
@@ -91,11 +91,11 @@ function entityreference_prepopulate_field_attach_form($entity_type, $entity, &$
// Store prepopulated values in the form state to make them persistent,
// in case the form is rebuilt by AJAX requests.
- if ($values = entityreference_prepopulate_get_values($field, $instance)) {
- $form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field['field_name']] = $values;
+ if ($ids = entityreference_prepopulate_get_values($field, $instance)) {
+ $form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field['field_name']] = $ids;
}
- if ($values || ($id && !empty($settings['action_on_edit']))) {
+ if ($ids || ($id && !empty($settings['action_on_edit']))) {
// New entity with prepopualte values, or an existing entity,
// we might need to disable/ hide the group-audience field.
if ($settings['action'] == 'disable') {
@@ -210,15 +210,11 @@ function entityreference_prepopulate_get_values($field, $instance, $validate = T
);
if (module_exists('og') && og_is_group_audience_field($field_name)) {
- if (empty($instance['field_mode'])) {
- // Group audience field, but no field-mode provided.
- return;
- }
- $identifier[] = $instance['field_mode'];
-
+ // Group audience field, but no field-mode provided.
+ $identifier[] = !empty($instance['field_mode']) ? $instance['field_mode'] : FALSE;
}
- $identifier = implode(',', $identifier);
+ $identifier = implode(':', $identifier);
if (isset($cache[$identifier])) {
return $cache[$identifier];