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.

Files: 
CommentFileSizeAuthor
#7 bean-1710256.patch1.65 KBjonhattan
FAILED: [[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
#2 bean-1710256-2.patch802 bytesindytechcook
FAILED: [[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
#1 bean-1710256.patch707 bytesjonhattan
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch bean-1710256.patch. Unable to apply patch. See the log in the details link for more information. View

Comments

jonhattan’s picture

Status: Active » Needs review
FileSize
707 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch bean-1710256.patch. Unable to apply patch. See the log in the details link for more information. View
indytechcook’s picture

FileSize
802 bytes
FAILED: [[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

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

FiNeX’s picture

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.

indytechcook’s picture

Status: Needs review » Needs work

Thanks for the quick test. I'll work on it some more.

betz’s picture

It looks reverse now. The delete button shows on the 'add form', but not on the 'edit form'.

jonhattan’s picture

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   }
jonhattan’s picture

Issue tags: -Release blocker
FileSize
1.65 KB
FAILED: [[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

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

jonhattan’s picture

Status: Needs work » Needs review
Issue tags: +Release blocker

Adjust issue tag

indytechcook’s picture

Priority: Normal » Critical
Status: Needs review » Needs work
Issue tags: +Release blocker

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?

indytechcook’s picture

jonhattan’s picture

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

jonhattan’s picture

Status: Needs work » Fixed

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