diff --git a/panopoly_magic.module b/panopoly_magic.module index 740f358..e7f14be 100644 --- a/panopoly_magic.module +++ b/panopoly_magic.module @@ -276,7 +276,6 @@ function panopoly_magic_form_alter(&$form, &$form_state, $form_id) { $entity = $form_state['entity']; // Copy hardcoded fields. - $entity->fpid = NULL; $entity->title = $form_state['values']['title']; $entity->link = $form_state['values']['link']; $entity->path = $form_state['values']['path']; @@ -293,13 +292,17 @@ function panopoly_magic_form_alter(&$form, &$form_state, $form_id) { $entity->log = $form_state['values']['log']; } - field_attach_form_validate('fieldable_panels_pane', $entity, $form, $form_state); - field_attach_submit('fieldable_panels_pane', $entity, $form, $form_state); - // // End code copied from fieldable_panels_panes_entity_edit_form_submit(). // + if (!isset($entity->fpid)) { + $entity->fpid = NULL; + } + + field_attach_form_validate('fieldable_panels_pane', $entity, $form, $form_state); + field_attach_submit('fieldable_panels_pane', $entity, $form, $form_state); + // Set the callback to use for rendering the preview. $preview_callback = 'panopoly_magic_render_fieldable_panels_pane_preview';