diff --git a/drupal/profiles/panopoly/modules/panopoly/panopoly_magic/panopoly_magic.module b/drupal/profiles/panopoly/modules/panopoly/panopoly_magic/panopoly_magic.module index 808991b..3cda286 100755 --- a/drupal/profiles/panopoly/modules/panopoly/panopoly_magic/panopoly_magic.module +++ b/drupal/profiles/panopoly/modules/panopoly/panopoly_magic/panopoly_magic.module @@ -63,6 +63,18 @@ function panopoly_magic_configure_form($form, &$form_state) { '#description' => t('Do you want to automatically generate previews when adding existing panels panes through the IPE?'), ); + $form['panopoly_magic_strip_js_from_preview'] = array( + '#title' => t('Strip embedded .js from previews'), + '#type' => 'select', + '#required' => TRUE, + '#options' => array( + '1' => t('Enabled'), + '0' => t('Disabled'), + ), + '#default_value' => variable_get('panopoly_magic_strip_js_from_preview', 0), + '#description' => t('Some embedded javascript may cause issues with panopoly and the IPE, stripping the .js from your previews will fix this issue, but may alter the look of the preview.'), + ); + return system_settings_form($form); } @@ -1186,6 +1198,7 @@ function panopoly_magic_preprocess_panels_add_content_modal(&$vars) { if (!empty($vars['categories'][$vars['category']]['content'])) { foreach ($vars['categories'][$vars['category']]['content'] as &$plugin) { $use_preview = variable_get('panopoly_magic_pane_add_preview', 1); + $strip_js = variable_get('panopoly_magic_strip_js_from_preview', 0); $query = drupal_get_query_parameters(); $preview_panes = (!empty($query['preview_panes'])) ? explode(',', $query['preview_panes']) : array(); @@ -1211,6 +1224,9 @@ function panopoly_magic_preprocess_panels_add_content_modal(&$vars) { ); $plugin['preview'] = ''; } + if (!empty($strip_js) && !empty($plugin['preview'])) { + $plugin['preview'] = preg_replace('#(.*?)#is', '', $plugin['preview']); + } } } }