Deleting GlobalArea in v8?
Permalink 1 user found helpful
After renaming a GlobalArea in my theme, I wanted to delete the old name's entry in the dashboard. But in the dashboard I can only "Clear Global Area", I can not delete it.
Is there really no easy way to delete obsolete global areas? Do I have to do it programmatically with Stack::delete()?
Is there really no easy way to delete obsolete global areas? Do I have to do it programmatically with Stack::delete()?
Hi,
thanks for your answer.
As global areas are designed as stacks internally (actually a global area puts it's content into a stack with type "global area"), it should be as simple as calling Stack::delete().
Manual database changes are not the way to go I think: A Stack is a Page is a Collection that contains Blocks. If the Stack is a global area it has an association to a GlobalArea object that is an area. I would not want to fiddle with these SQL statements manually ;)
Stack::delete() takes this all into account. I will give it a try and report it.
I'm wondering if no one else did ever come across this issue? While creating a new complex theme I regularly change names of GlobalAreas and the list of obsolete areas in the "stack" view is getting longer and longer...
thanks for your answer.
As global areas are designed as stacks internally (actually a global area puts it's content into a stack with type "global area"), it should be as simple as calling Stack::delete().
Manual database changes are not the way to go I think: A Stack is a Page is a Collection that contains Blocks. If the Stack is a global area it has an association to a GlobalArea object that is an area. I would not want to fiddle with these SQL statements manually ;)
Stack::delete() takes this all into account. I will give it a try and report it.
I'm wondering if no one else did ever come across this issue? While creating a new complex theme I regularly change names of GlobalAreas and the list of obsolete areas in the "stack" view is getting longer and longer...
OK, this seems the current way to go:
This loads the Global Area with name "Header Navigation" and removes it completely. This way I was able to remove all the old, unused global areas floating around in the dashboard...
There really should be a button for it in the dashboard.
$s = \Stack::getByName("Header Navigation"); $s->delete();
This loads the Global Area with name "Header Navigation" and removes it completely. This way I was able to remove all the old, unused global areas floating around in the dashboard...
There really should be a button for it in the dashboard.
Yep, especially because the default installation creates a few global areas even if you choose the empty install.
I think in concrete5 v7 you could delete stacks in the dashboard, so I don't think it's a big deal to implement this.
I think in concrete5 v7 you could delete stacks in the dashboard, so I don't think it's a big deal to implement this.
that worked for me! thanks alot..
Excellent, thank you! Ran these lines from within my theme and it deleted the area. Nice work.
I had attempted to insert an SVG image via a C5 Image Block within a global footer area, which resulted in an error that no image could be created in the global area dashboard interface. The "clear area" became disabled. I changed the name of the Global Area in my theme, which created a new area for me, but I still couldn't delete the old area. This did the trick.
I had attempted to insert an SVG image via a C5 Image Block within a global footer area, which resulted in an error that no image could be created in the global area dashboard interface. The "clear area" became disabled. I changed the name of the Global Area in my theme, which created a new area for me, but I still couldn't delete the old area. This did the trick.
I am not aware of a way to delete an area (global or non-global) through the dashboard.
If this issue is still valid, one way to do it is to edit the database manually (Area and Stacks tables):
https://www.concrete5.org/developers/bugs/5-7-3-1/cant-create-global...
I recommend a full backup (files and database) before making any changes.
There looks to be a method for removing global areas and another method for removing stacks:
https://github.com/concrete5/concrete5/blob/develop/concrete/src/Are...
https://github.com/concrete5/concrete5/blob/develop/concrete/src/Pag...