tpr Posted October 6, 2016 Share Posted October 6, 2016 I've run into this several times and it seems like a bug, or at least it's misleading. Steps to reproduce: Add a new template, eg 'news' Set its fieldgroup to another template, eg. 'basic-page' Edit a field that is in 'basic-page' template, and remove from all templates Now you you would assume that you can delete the field because it's not used in any templates, but you can't. Trying to delete from api reveals that it's used by the 'news' template, which obviously shouldn't be true because it uses the fieldgroup of 'basic-page'. Unfortunately I can't set the 'news' template's fieldgroup to another one because of data loss. I could remove it only via api using fieldgroup->softRemove(). Is there a better way of getting rid of such fields? 1 Link to comment Share on other sites More sharing options...
tpr Posted October 6, 2016 Author Share Posted October 6, 2016 Here is the code I have used with Tracy Console to remove fields: $fieldgroup = wire('fieldgroups')->get('forms'); foreach(array('admin_column_left', 'admin_column_left_END', 'admin_column_right', 'admin_column_right_END') as $ff) { if(!$fieldgroup->get($ff)) continue; $fieldgroup->softRemove($ff); $fieldgroup->save(); wire('fields')->delete(wire('fields')->get($ff)); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now