$field_data = self::$data['custom_field_defs'][$field_name]; // Data object we will save if (!($FieldObj = CCTM::load_object($field_type, 'fields'))) { die('Field not found.'); } $field_data['original_name'] = $field_name; $FieldObj->set_props($field_data); $data['change_field_type'] = '<br/><a href="?page=cctm_fields&a=change_field_type&field=' . $field_name . '&_wpnonce=' . wp_create_nonce('cctm_change_field_type') . '" class="button">' . __('Change Field Type', CCTM_TXTDOMAIN) . '</a></p>'; // Save if submitted... if (!empty($_POST) && check_admin_referer($data['action_name'], $data['nonce_name'])) { // A little cleanup before we handoff to save_definition_filter unset($_POST[$data['nonce_name']]); unset($_POST['_wp_http_referer']); // Handle editing of the associations // All associations were removed $post_type_defs = CCTM::get_post_type_defs(); if (!isset($_POST['post_types'])) { // die('All associations removed...'); foreach ($displayable_types as $pt) { $def = array(); if (isset(CCTM::$data['post_type_defs'][$pt])) { $def = CCTM::$data['post_type_defs'][$pt]; } if (is_array($def['custom_fields']) && in_array($field_name, $def['custom_fields'])) { $revised_custom_fields = array(); foreach ($def['custom_fields'] as $cf) { if ($cf != $field_name) { $revised_custom_fields[] = $cf; } } CCTM::$data['post_type_defs'][$pt]['custom_fields'] = $revised_custom_fields;