Posted by jonhattan on August 2, 2012 at 1:11pm
5 followers
| Project: | Bean |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | Release blocker |
Issue Summary
This button is part of the block type add form. It's supposed to be available only for edit form. This is a bug introduced in 613a302e0f8b88fb26c4e25cf38be55b8a1abbe1
Nowadays it seems a leftover, since block types are remove now from the overview page.
Comments
#1
#2
So there is a bug with the delete button showing. It should show on the edit form. Here is a patch. Please test.
#3
The last patch doesn't work on the current -dev release: the delete button is not shown.
Even after creating the bean block type,
$form['new']is an array with the#valuealways "TRUE".Moreover, if you skip the if included in the patch, the delete button is visible but it throws two errors:
And the redirected page (admin/structure/block-types/manage//delete) is not found.
#4
Thanks for the quick test. I'll work on it some more.
#5
It looks reverse now. The delete button shows on the 'add form', but not on the 'edit form'.
#6
If the bean is exported to code, $form['new'] is always true, because of:
85 elseif (!method_exists($bean_type, 'getExportStatus') || $bean_type->getExportStatus() == 'Normal') {86 $form['new'] = array(
87 '#type' => 'value',
88 '#value' => FALSE,
89 );
90 }
#7
A fix is attached:
* don't show the button on creating a bean_type
* don't show the button if the bean is exported to code and not overridden
* show otherwise: if it's not exported to code or if it's in code and overridden (in this case the button label changes to 'revert')
#8
Adjust issue tag
#9
Thanks jonhattan. I echoed one comment from #1785950: Revert and delete should be separate operations. THanks for the issue tag also.
+++ b/bean_admin_ui/bean_admin_ui.admin.incundefined@@ -138,16 +138,18 @@ function bean_admin_ui_type_form($form, &$form_state, $bean_type = NULL) {
+ $export_status = $bean_type->getExportStatus();
We can't assume getExportStatus() exists.
+++ b/bean_admin_ui/bean_admin_ui.admin.incundefined@@ -169,7 +171,7 @@ function bean_admin_ui_type_form_submit(&$form, &$form_state) {
+ $form_state['redirect'] = 'admin/structure/block-types/manage/' . $form['bean_type']['#value']->type . '/delete';
May I ask why this change was necessary?
#10
Thanks http://drupal.org/commitlog/commit/22232/2f4075ef5d6b3ccc6a30259fcc7aad5...
#11
Sorry for the delay in my response, I've been relocatring to another city.
On your second question in #9. I think I did this just because the object is primarily assigned to $form['bean_type'] but can't remember details now. Once I test the new code will open new issues if neccesary.
Note that you introduced a patch file in the root directory with this commit: bean-1786036.patch
#12
Created a new issue for that #1814068: Remove leftover patch files in repo
#13
Automatically closed -- issue fixed for 2 weeks with no activity.