case 'create': // Record new Itemtype // Record new Itemtype case 'create_new': // Record Itemtype and create new // Record Itemtype and create new case 'create_copy': // Record Itemtype and create similar // Insert new post type...: // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('itemtype'); $edited_Itemtype = new ItemType(); // Check permission: $current_User->check_perm('options', 'edit', true); // load data from request if ($edited_Itemtype->load_from_Request()) { // We could load data from form without errors: if ($edited_Itemtype->is_special()) { // is special post type param_error('ityp_ID', sprintf(T_('Post types with ID from %d to %d are reserved. Please use another ID.'), $special_range[0], $special_range[1])); // Set to 0 in order to display an edit input box for name field $edited_Itemtype->ID = 0; // Set name from request $edited_Itemtype->set('name', param('ityp_name', 'string', '')); } else { // ID is good // While inserting into DB, ID property of Userfield object will be set to autogenerated ID // So far as we set ID manualy, we need to preserve this value // When assignment of wrong value will be fixed, we can skip this $entered_itemtype_id = $edited_Itemtype->ID; // Insert in DB: