diff --git a/og.module b/og.module index caf6ced..b7759c5 100644 --- a/og.module +++ b/og.module @@ -776,24 +776,6 @@ function og_field_attach_form($entity_type, $entity, &$form, &$form_state, $lang continue; } - // Does the primary field need to be forced to optional? - if ($field['settings']['handler_settings']['force_optional_primary']) { - if (user_access('administer group')) { - $lang = field_language($entity_type, $entity, $primary_field); - $form_primary = &$form[$primary_field][$lang]; - - if ($form_primary['#required']) { - $form_primary['#required'] = FALSE; - // Need to add a "None" option now that the field is required: - $form_primary['#options'] = array('_none' => t('- None -')) + $form_primary['#options']; - - if (is_array($form_primary['#default_value']) && !count($form_primary['#default_value'])) { - $form_primary['#default_value'][] = '_none'; - } - } - } - } - // Intersect the IDs from the primary field, with the referencable IDs // from the secondary, by validating the IDs. if (!is_array($primary_ids)) { @@ -900,7 +882,7 @@ function og_form_secondary_field_validate($form, &$form_state) { $items = FALSE; field_default_extract_form_values($entity_type, $entity, $primary_field, $primary_instance, $langcode, $items, $form, $form_state); foreach ($items as $item) { - if (!empty($item['target_id']) && $item['target_id'] != '_none') { + if (!empty($item['target_id'])) { ++$count; } } diff --git a/plugins/entityreference/selection/OgSelectionHandler.class.php b/plugins/entityreference/selection/OgSelectionHandler.class.php index 17ea9af..4241ff5 100644 --- a/plugins/entityreference/selection/OgSelectionHandler.class.php +++ b/plugins/entityreference/selection/OgSelectionHandler.class.php @@ -44,7 +44,6 @@ class OgSelectionHandler extends EntityReference_SelectionHandler_Generic { 'reference_type' => 'my_groups', 'primary_field' => FALSE, 'hide_secondary_field' => TRUE, - 'force_optional_primary' => TRUE, ); $form['target_bundles'] = array( @@ -126,19 +125,6 @@ class OgSelectionHandler extends EntityReference_SelectionHandler_Generic { ), ), ); - - $form['force_optional_primary'] = array( - '#type' => 'checkbox', - '#title' => t('Force optional primary field'), - '#description' => t("Force the primary field to be optional when the secondary field is shown. This can prevent problems when admins edit group content for groups they're not members of."), - '#default_value' => $settings['force_optional_primary'], - '#states' => array( - 'invisible' => array( - ':input[name="field[settings][handler_settings][primary_field]"]' => array('value' => 0), - ), - ), - ); - form_load_include($form_state, 'php', 'og', '/plugins/selection/og.class'); }