我正在尝试添加acl权限以允许/停止用户添加图片。我有acl部分工作。我只需要知道如何从块中删除按钮。
我在观察员中试过这个:
// get the block we are working with
$block = $observer->getBlock();
// if the block is null, there is no need to go any further
if( $block === null ) { return $this; }
if( $block instanceof Mage_Adminhtml_Block_Media_Uploader ) {
if( ! Mage::getSingleton('admin/session')->isAllowed('catalog/products/edit_product_button') ) {
// I tried this too
// $block->unsetChildren();
$block->unsetChild('browse_button');
$block->unsetChild('upload_button');
$block->unsetChild('delete_button');
}
}
我已刷新缓存和缓存存储,按钮仍在显示。我做错了什么?