diff --git a/panopoly_magic.module b/panopoly_magic.module index e7f14be..6c3c9b1 100644 --- a/panopoly_magic.module +++ b/panopoly_magic.module @@ -311,6 +311,12 @@ function panopoly_magic_form_alter(&$form, &$form_state, $form_id) { } } + // Add our own submit handler ALWAYS, not just when we are generating + // a preview. + if ($form_id == 'fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form') { + $form['#submit'][] = '_panopoly_magic_fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form_submit'; + } + // Set the configuration and determine the content for the pane $configuration_ids = array( 'ctools_entity_field_content_type_formatter_options', @@ -466,6 +472,17 @@ function panopoly_magic_form_alter(&$form, &$form_state, $form_id) { } /** + * Submission callback for fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form(). + */ +function _panopoly_magic_fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form_submit($form, &$form_state) { + $entity = $form_state['entity']; + + // The live preview causes a stale version of the entity to exist in the + // entity controller's static cache, so we much clear it on submit. + entity_get_controller('fieldable_panels_pane')->resetCache(array($entity->fpid)); +} + +/** * Content panes should not use default system/ajax. Use our own for now. */ function _panopoly_magic_add_path_to_ajax($element) {