When you go through the "Add box" flow, the additional_classes value is not saved because it doesn't exist as a default option in class boxes_simple.

However, when you go to edit that same box, it is saved because there is code in the module that takes care of this setting.

The proposed fix simply adds additional_classes as a default option in boxes_simple.

EDIT Realized there are other ways to fix this. In addition to the above, you could:

1) handle the setting internally in class boxes_box::factory, or
2) add the default option in class boxes_box via options_defaults() or similar.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

favrik’s picture

Issue summary: View changes
jacktonkin’s picture

Title: additional_classes is not saved when adding a box » Boxes being saved twice on add.
Version: 7.x-1.1 » 7.x-1.2
Status: Active » Needs review
FileSize
658 bytes

It turns out that boxes are being built and saved twice in boxes_box_form_submit and boxes_add_form_submit.

The first of these handles additional_classes and also calls the options_submit() method, so the attached patch reduces the second to:

function boxes_add_form_submit($form, &$form_state) {
  drupal_set_message(t('%name has been created.', array('%name' => $form_state['values']['description'])));
}

Status: Needs review » Needs work

The last submitted patch, 2: boxes-box_add_form_submit-2226125-2.patch, failed testing.

Status: Needs work » Needs review

The last submitted patch, additional_classes_not_saved_when_adding_box.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 2: boxes-box_add_form_submit-2226125-2.patch, failed testing.