Download & Extend

«Delete block type» button misplaced

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

Status:active» needs review
AttachmentSizeStatusTest resultOperations
bean-1710256.patch707 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch bean-1710256.patch. Unable to apply patch. See the log in the details link for more information.View details

#2

So there is a bug with the delete button showing. It should show on the edit form. Here is a patch. Please test.

AttachmentSizeStatusTest resultOperations
bean-1710256-2.patch802 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch bean-1710256-2.patch. Unable to apply patch. See the log in the details link for more information.View details

#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 #value always "TRUE".

Moreover, if you skip the if included in the patch, the delete button is visible but it throws two errors:

  • Notice: Undefined index: bean_type in bean_admin_ui_type_form_submit_delete() (line 171 [...])
  • Notice: Trying to get property of non-object in bean_admin_ui_type_form_submit_delete() (line 171 [...])

And the redirected page (admin/structure/block-types/manage//delete) is not found.

#4

Status:needs review» needs work

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

Title:Remove «Delete block type» button» «Delete block type» button misplaced

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

Status:needs work» needs review

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')

AttachmentSizeStatusTest resultOperations
bean-1710256.patch1.65 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch bean-1710256_0.patch. Unable to apply patch. See the log in the details link for more information.View details

#8

Issue tags:+Release blocker

Adjust issue tag

#9

Priority:normal» critical
Status:needs review» needs work

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

#11

Status:fixed» needs work

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

Status:needs work» fixed

Created a new issue for that #1814068: Remove leftover patch files in repo

#13

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here