By krymp on
How can I remove unused block from displaying. Such as "Powered by Drupal" block, I am trying to keep everything tidy in the admin and just want everything to be super clean.
How can I remove unused block from displaying. Such as "Powered by Drupal" block, I am trying to keep everything tidy in the admin and just want everything to be super clean.
Comments
Wow, you didn't even try a
Wow, you didn't even try a single thing before posting your question, did you? Every block has two options next to it, Region and Configure. Just change the region to or drag it to the Disabled region at the bottom.
That wasn't my question. I
That wasn't my question. I asked how to remove it from displaying...EVEN IN THE DISABLED SECTION!!!!!!!!!!!!!!! Sorry I didn't make that part clear enough, I just assumed people would understand.
Some custom blocks allow you to delete...but not the default blocks that come installed in drupal such as "Powered by Drupal"
You can only remove module
You can only remove module provided blocks by disabling the module.
There's no need
Why are you bothering to remove the block if it never appears on the website? You've explained it clearly enough and yet I still don't understand. Sounds like a waste of time to me.
Because I may not always be
Because I may not always be the user of the admin. So I dont want blocks that will never be used to display, even if its pushed into the unused portion. It's less options that another admin user has to deal with. So while it may sound like a waste of time to you, it would be a time saver for me because I dont have to go into the admin myself all the time. It just keeps everything super clean and organized.
Performance for one thing
I take it you don't use aggregator or panels, bot of which can create a HUGE number of unused blocks. I have one Panels-based site whre the blocks page, mostly unused, takes 5 minutes to load. If you configure a block, then you have another 5 minutes before you can move it to a different region.
This is an excellent idea and probably belongs in the Utilities module, unless someone wants to create a whole module fo this.
NancyDru
I have already added some
I have already added some time ago a similar feature request in Utilities module, see #798572: Hide Unused Blocks.
Yes
I will see what I can do about it when I have time.
NancyDru
Wow tonicboy, you really
Wow tonicboy, you really didn't even try READING his post before replying, did you? Seriously though, he didn't ask how to disable. He asked how to remove. In the future, you're better off not posting than coming off in such a brash fashion.
I agree, this would be super
I agree, this would be super helpful! Does anyone know how to do this?
I would also like to remove blocks
Since I was creating blocks trying to get DDBlocks working I have several versions of the same block name in the list I would like to be removed, not just disabled.
I'd like a solution for this
I'd like a solution for this as well since the admin/build/block page is cluttered with blocks such as Who's Online/Who's New/Powered by Drupal etc and it takes a long time to render.
I would also like to have
I would also like to have this feature, I have Open Calais switched on and the number of Taxonomy blocks which I will never use is making my blocks page take a really long time to load. Would really ap[preicate help in this matter..
Thanks
Jaya
Don't produce them
You should start by opening a feature request with Open Calais to not make available the blocks you don't want to see. The same is true for any other module that makes a lot of never-used blocks. The true "cure" for this issue is prevention.
NancyDru
subscribing
subscribing
subscribe
subscribe
subscribe
subscribe
subscribe
subscribe
Sounds good to me! What a
Sounds good to me!
What a pain in the arse it is to do anything with blocks!
Takes forever to load the page! Takes more time fooling around with the blocks page then it does building the site!
Maybe its a server thing though?
*Added - one thing you can do to remove blocks is through Views. Seems anytime I created a view a block was created as well. Click on "Block" then "Remove Display"
The flow
Understanding the flow of Drupal can help you understand why such pages are so slow.
When you go to the Blocks admin page, every enabled module is invoked for what blocks it provides, then the database is updated with the resulting list. This is a HUGE overhead. I would, at the very least, prefer a button that says, "Rebuild the list" so that invoking all the modules is bypassed and the database only has to be read (which then means the list could be cached). But that is a core issue, which means that it would be pushed out to D8 at the earliest.
NancyDru
It Is Much Easier Than You Think !
I was wondering how to do it just like you! Then with some playing around with my site files I figured out how to do it:
/htdocs/drupal/sites/all/themes/rootcandy"..info" file, open that file and there you can seeregions[block_name]=block_titlelist where you can delete unused blocks from!Good Luck !
drupal.newbie, Could you
drupal.newbie,
Could you please explain how this works? Theme .info files are not updated when blocks are added therefore no block data exists within the .info file.
Could you provide an example on how to remove the "Powered by Drupal" block?
Thank you very much in advance!
BigMike
Simple
Go to the Blocks admin page and set the region to "None."
NancyDru
I already have many unused
I already have many unused blocks -- unused means < none > Region -- and this does not remove the unused blocks as asked by krymp.
And if you do...
And if you do remove the unused blocks, how would you ever enable one later on?
The best way to remove them is to not have the modules create them to start with.
NancyDru
X2 to your comment on the
X2 to your comment on the module creation.
What if we had a collapsible field where unused and "never will be used" modules could be dragged to?
Hmm
I suppose one could insert a collapsed fieldset into the table (by taking over the theme function), but that won't make the page load any faster and would probably prevent dragging the block to another region (the drop down would still work). However, defining a new region ("Never") would cause those blocks to be executed, thus slowing down the whole site, unless a change to the block module is made.
NancyDru
That just contains the
That just contains the regions - not the blocks.
At least in my theme.info
Removing/hiding unused blocks
Having at least a place to tuck away unused/never will use blocks would help keep the block page organized and keep those of us who are new on the scene remain physically and mentally organized. Best would be the ability to remove these blocks altogether.
What I have been doing is
What I have been doing is disabling javascript whenever I view the blocks page.
Speeds things up a little bit, and doesn't reset the weight of everything.
WOW This really speeds things
WOW This really speeds things up!! It also fixes my black table CSS issue described here.
Hmm...
Interesting. I wonder if I can stack theme functions like I can submit handlers?
NancyDru
subscribe
subscribe
A SOLUTION FOR THIS
I use "Powered Drupal" block for example:
1: use hook_block_info_alter(&$blocks)
2: set
3: Then click "save" in list block form ... the block hides
4: FINISHED
That means: the block will be enable but its region is -1 => Don't know where to show ... :)
tpl.php way
Copy block-admin-display-form.tpl.php from modules/blocks to your theme folder.
Add
if($region!=-1):before this line:foreach ($block_listing[$region] as $delta => $data):Of course you should add
endif;aferendforeach;Clear cache.
And thats it!
If yo want to remove only certain block you can use this preprocess function in template.php:
(system_0 is name of Powered by Drupal block) use Devel module to find out module name
Sasha
Print & Screen
But
Just keep in mind that this eliminates any possibility of enabling a block because you will not be able to see it.
NancyDru
I agree
I agree, but if you want to disable blocks that you will never use you can use preprocess function in template.php.
Here is the list of blocks that I will never use:
Note that I have disabled primary and secondary menus because I don't use them as blocks.
As you can see I have cleared a whole bunch of blocks! 29 useless blocks! And of course if you need to enable one of them just comment that line.
Sasha
Print & Screen
I just setup the function
I just setup the function YOURTHEMENAME_preprocess_block_admin_display_form method and it works great! Thanks!!
subscribe.
subscribe.
Slightly tidier way of doing things
This works the other way round, removing all modules by default and explicitly allowing them. Just add the module name to the array if it should be allowed.
Interesting approach
For those who are on slower servers, be aware that this slightly increases CPU usage building the list, but cuts down on data transfer to the browser, which is probably the bigger problem.
NancyDru
I copied and set up the
I copied and set up the block-admin-display-form.tpl.php like the comment above said.
Then I tried doing this in my theme's template.php:
And it just hid everything in the disabled block section of the block administration page. Why is it hiding everything for me and not just the one block?
Use Context Module
Then you won't have a messy block admin page? http://drupal.org/project/context
You will also gain some other UI benefits.
+1
+1
Some workaround to disable blocks on admin
I know this is a very old thread, just opening it up for those with similar scenario.
You can, for any reason, remove the blocks on the admin page only. Please do note that this does not do anything rather than remove the block delta on the block list admin page
Where $deltas will be an array of block deltas you want to remove.
Doing this approach, the original region of a specific block will be preserved. For example, that block is assigned to the header region, then you apply this code, It will still remain on the header region, but you won't see it in the block list page.
A specific use case for this is: