Jump to content

Global field removal


MichaMichaMicha
 Share

Recommended Posts

The 'global' flag for field is great, untill you don't need that field anymore and you have over 30 templates that have that field assigned...

It looks like you have to manually edit every template and delete the field from there, save, then check the checkbox to confirm?

Is there a way to do this faster?

Thanks.

Link to comment
Share on other sites

That's fun:

foreach($templates as $template){
    foreach($template->fieldgroup as $field){
        if($field->name == "myfield"){
            $template->fieldgroup->remove($field);
            $template->fieldgroup->save();
            echo "deleted $field->name";
        }
    }
}
  • Like 5
Link to comment
Share on other sites

That's fun:

foreach($templates as $template){
    foreach($template->fieldgroup as $field){
        if($field->name == "myfield"){
            $template->fieldgroup->remove($field);
            $template->fieldgroup->save();
            echo "deleted $field->name";
        }
    }
}

I was looking for some something in the Admin, but this works as well... Thanks!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...