Simulating admin block list

Events happening in the community are now at Drupal community events on www.drupal.org.
cithukyaw's picture

Hi Drupalers,

I have a registered menu ( siteadm/block/list ) referring to admin/build/block.
After submitted "Blocks" form, I want form redirection to siteadm/block/list.

I changed $form['#redirect'] in hook_form_alter of my module, but it doesn't work. What could that happen ?
It still redirects to admin/build/block.

I got to hack the core module "block".
My purpose is to let customer access to the page admin/build/block with my custom menu ( siteadm/block/list ) and I want to make the page admin/build/block as my own.

Any idea ?

Comments

Hi, via phpmyadmin or other

ziobudda's picture

Hi, via phpmyadmin or other mysql gui try to see if the weigth of your module is higher than other modules (if I don't wrong remeber the table is "system").

M.

If that doesn't work, try

vkareh's picture

If that doesn't work, try setting $form['#submit'][] = 'my_custom_submit'; in your hook_form_alter, then create

<?php
function my_custom_submit($form, &$form_state) {
 
$form_state['redirect'] = 'siteadm/block/list';
}
?>

Still doesn't work

cithukyaw's picture

My module have highest weight as I did it in mymodule.install file.

I tried the followings in mymodule_form_alter() :
1. $form['#redirect'] = 'siteadm/block/list';
2. $form_state['redirect'] = 'siteadm/block/list';

And also tried as vkareh's advice in my custom form submit function mymodule_block_admin_display_form_submit().

And also tried to attach the '#submit' of the button
$form['submit']['#submit'][] = 'mymodule_block_admin_display_form_submit';

Unfortunately, all didn't work. Still redirect to "admin/build/block".
I'm using D6.
I have been wasting a lot of my time for this simple task using Drupal.

With Regards,
Sithu

Can you post your

ziobudda's picture

Can you post your "mymodule_form_alter()" function ?

$form_state is the container of the POST/GET form. You need to use $form.

$form['submit']['#submit'] ??? It is $form['#submit'] (like $form['#redirect']).

M.

Got it

cithukyaw's picture

My module folder structure is /sites/all/modules/mymodule and it has a sub-module /sites/all/modules/mymodule/contrib/mymodule_block.
What I found out is that form redirect override in hook_form_alter() doesn't work when implement it in mymodule_block.module.

<?php
function mymodule_block_form_alter(&$form, &$form_state, $form_id){
     if(
$form_id == 'block_admin_display_form'){
          
// **** Any of these doesn't work
          
$form['#redirect'] = 'siteadm/block/list';
          
//$form_state['redirect'] = 'siteadm/block/list';  
           //$form['#submit'][] = 'mymodule_block_block_admin_display_form_submit'
           //$form['submit']['#submit'] = 'mymodule_block_block_admin_display_form_submit'
    
}
}
?>

But, when implements it in mymodule.module, it works fine.

<?php
function mymodule_form_alter(&$form, &$form_state, $form_id){
     if(
$form_id == 'block_admin_display_form'){
          
//******it works fine
          
$form['#redirect'] = 'siteadm/block/list';
     }
}
?>

When I test other forms 'block_admin_configure' and 'block_add_block_form', they works fine wherever override $form['#redirect'].
I think the problem is only for the page admin/build/block.

With Regards,
Sithu

Another issue is that drupal

cithukyaw's picture

Another issue is that drupal renders the yellow-colored boxes to show developers where each region is.
How can I hide those yellow boxes ?

With Regards,
Sithu

Yellow Region Boxes

cithukyaw's picture

Another issue is that Drupal renders the yellow boxes to show developers where each region is in the page admin/build/block.
How can I hide those boxes ?
Where Drupal adds those into the regions ?

With Regards,
Sithu

Hide region boxes

dejavu_007's picture

I think the best way to do it is by using css "display:none" for class ".block-region" in theme style-sheet.

Titto Jose
www.tittojose.com

Yes, this is the best

cithukyaw's picture

Yes, this is the best way.
But, I have 3 pages simulating the page admin/build/block with different contents, for example,
1. siteadm/block/list
2. siteadm/block/sidebar1
3. siteadm/block/sidebar2
These 3 pages will be accessed from different menus.

I want to show the yellow boxes only in the page 1, NOT in the pages 2 and 3.
Thus, I think the best way is to find where Drupal renders those and how to override them.

With Regards,
Sithu