Skip to content

Commit 66fb4a8

Browse files
committed
Set JS to use var instead of let for ECMA compat
fix(patternkit.inc)
1 parent 2a41230 commit 66fb4a8

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

plugins/content_types/patternkit.inc

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ function patternkit_patternkit_content_type_edit_form($form, &$form_state) {
175175
'#type' => 'select',
176176
'#title' => 'Presentation style',
177177
'#options' => array(
178-
// 'webcomponent' => 'Web component',
178+
// 'webcomponent' => 'Web component',
179179
'html' => 'HTML inline',
180-
// 'json' => 'JSON (with js/css)',
180+
// 'json' => 'JSON (with js/css)',
181181
),
182182
'#default_value' => isset($conf['presentation_style']) ? $conf['presentation_style'] : '',
183183
);
@@ -221,35 +221,35 @@ function patternkit_patternkit_content_type_edit_form($form, &$form_state) {
221221
$url .= !empty($config->lzstring) ? "?data=" . $config->lzstring : '';
222222
}
223223

224-
$markup = "
225-
<iframe id='schema-editor-iframe' width='100%' height='1000px' src='$url'></iframe>
226-
<script>
227-
// Enlarge the ctools modal to make it easier to work with the iframe.
228-
jQuery('.ctools-modal-content').animate({width:'100%', height:'100%'});
229-
jQuery('#modalContent').animate({'width': '100%', 'left':'0px', 'top':'0px'});
230-
jQuery('#modal-content').animate({'width': '100%', 'height': '100%'});
231-
232-
let schemaDataSaved = false;
233-
// Respond to data events.
234-
window.addEventListener('message', function(event) {
235-
if (event.data.name && event.data.name === 'saveData') {
236-
let configObject = JSON.stringify(event.data);
237-
document.getElementById('schema_instance_config').value = configObject;
238-
console.log('config object', configObject);
239-
schemaDataSaved = true;
240-
jQuery('#patternkit-patternkit-content-type-edit-form').trigger('submit');
241-
}
242-
});
243-
244-
document.getElementById('patternkit-patternkit-content-type-edit-form').onsubmit = function(){
245-
if (schemaDataSaved === false) {
246-
let frame = document.getElementById('schema-editor-iframe');
247-
frame.contentWindow.postMessage('sendSaveData', '*');
248-
return false;
249-
}
250-
};
251-
</script>
252-
";
224+
$markup = <<< HTML
225+
<iframe id='schema-editor-iframe' width='100%' height='1000px' src='$url'></iframe>
226+
<script>
227+
// Enlarge the ctools modal to make it easier to work with the iframe.
228+
jQuery('.ctools-modal-content').animate({width:'100%', height:'100%'});
229+
jQuery('#modalContent').animate({'width': '100%', 'left':'0px', 'top':'0px'});
230+
jQuery('#modal-content').animate({'width': '100%', 'height': '100%'});
231+
232+
var schemaDataSaved = false;
233+
// Respond to data events.
234+
window.addEventListener('message', function(event) {
235+
if (event.data.name && event.data.name === 'saveData') {
236+
var configObject = JSON.stringify(event.data);
237+
document.getElementById('schema_instance_config').value = configObject;
238+
console.log('config object', configObject);
239+
schemaDataSaved = true;
240+
jQuery('#patternkit-patternkit-content-type-edit-form').trigger('submit');
241+
}
242+
});
243+
244+
document.getElementById('patternkit-patternkit-content-type-edit-form').onsubmit = function(){
245+
if (schemaDataSaved === false) {
246+
var frame = document.getElementById('schema-editor-iframe');
247+
frame.contentWindow.postMessage('sendSaveData', '*');
248+
return false;
249+
}
250+
};
251+
</script>
252+
HTML;
253253

254254
$form['configuration'] = array(
255255
'#type' => 'markup',
@@ -406,15 +406,15 @@ function patternkit_patternkit_content_type_render(
406406
),
407407
)
408408
);
409-
//
410-
// if (!empty($config['pkdata']['attachments'])) {
411-
// $settings = _patternkit_merge_js(
412-
// $config['pkdata']['attachments'],
413-
// $base_dependencies
414-
// );
415-
// dpm($settings, 'settings');
416-
// dpm($base_dependencies, 'bd');
417-
// }
409+
//
410+
// if (!empty($config['pkdata']['attachments'])) {
411+
// $settings = _patternkit_merge_js(
412+
// $config['pkdata']['attachments'],
413+
// $base_dependencies
414+
// );
415+
// dpm($settings, 'settings');
416+
// dpm($base_dependencies, 'bd');
417+
// }
418418

419419

420420
// Build the response object.

0 commit comments

Comments
 (0)