@@ -136,7 +136,7 @@ function patternkit_patternkit_content_type_admin_info(
136
136
137
137
if (empty ($ module ->title )) {
138
138
$ block ->title = "BROKEN/MISSING MODULE ( $ subtype) " ;
139
- $ block ->content = " BROKEN/MISSING MODULE " ;
139
+ $ block ->content = ' BROKEN/MISSING MODULE ' ;
140
140
141
141
return $ block ;
142
142
}
@@ -165,19 +165,19 @@ function patternkit_patternkit_content_type_edit_form($form, &$form_state) {
165
165
$ module = _patternkit_get_metadata ($ subtype );
166
166
167
167
// Remove the title override fields.
168
- unset($ form ['override_title_markup ' ]);
169
- unset( $ form ['override_title ' ]);
170
- unset( $ form ['override_title_text ' ]);
171
- unset( $ form ['override_title_heading ' ]);
168
+ unset($ form ['override_title_markup ' ],
169
+ $ form ['override_title ' ],
170
+ $ form ['override_title_text ' ],
171
+ $ form ['override_title_heading ' ]);
172
172
173
173
// @TODO: Re-enable the other formats.
174
174
$ form ['presentation_style ' ] = array (
175
175
'#type ' => 'select ' ,
176
176
'#title ' => 'Presentation style ' ,
177
177
'#options ' => array (
178
- // 'webcomponent' => 'Web component',
178
+ // 'webcomponent' => 'Web component',
179
179
'html ' => 'HTML inline ' ,
180
- // 'json' => 'JSON (with js/css)',
180
+ // 'json' => 'JSON (with js/css)',
181
181
),
182
182
'#default_value ' => isset ($ conf ['presentation_style ' ]) ? $ conf ['presentation_style ' ] : '' ,
183
183
);
@@ -210,51 +210,14 @@ function patternkit_patternkit_content_type_edit_form($form, &$form_state) {
210
210
'#default_value ' => isset ($ conf ['instance_config ' ]) ? $ conf ['instance_config ' ] : '' ,
211
211
);
212
212
213
- $ patternkit_host = variable_get (
214
- 'patternkit_pl_host ' ,
215
- 'http://localhost:9001 '
216
- );
217
- $ url = $ patternkit_host . '/schema/editor/ ' . substr ($ subtype , 3 );
218
-
219
- if (!empty ($ conf ['instance_config ' ])) {
220
- $ config = json_decode ($ conf ['instance_config ' ]);
221
- $ url .= !empty ($ config ->lzstring ) ? "?data= " . $ config ->lzstring : '' ;
222
- }
223
-
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 ;
253
-
254
- $ form ['configuration ' ] = array (
255
- '#type ' => 'markup ' ,
256
- '#markup ' => $ markup ,
257
- );
213
+ $ editor = $ module ->library ->getEditor ($ subtype );
214
+ if (!is_array ($ editor )) {
215
+ $ editor = array (
216
+ '#type ' => 'markup ' ,
217
+ '#markup ' => $ editor ,
218
+ );
219
+ }
220
+ $ form ['configuration ' ] = $ editor ;
258
221
259
222
return $ form ;
260
223
}
@@ -401,20 +364,20 @@ function patternkit_patternkit_content_type_render(
401
364
$ content ,
402
365
array (
403
366
'patternkit ' => array (
404
- 'pattern ' => $ subtype ,
367
+ 'PatternkitPattern ' => $ subtype ,
405
368
'instance_id ' => $ instance_id ,
406
369
),
407
370
)
408
371
);
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
- // }
372
+ //
373
+ // if (!empty($config['pkdata']['attachments'])) {
374
+ // $settings = _patternkit_merge_js(
375
+ // $config['pkdata']['attachments'],
376
+ // $base_dependencies
377
+ // );
378
+ // dpm($settings, 'settings');
379
+ // dpm($base_dependencies, 'bd');
380
+ // }
418
381
419
382
420
383
// Build the response object.
@@ -431,7 +394,7 @@ function patternkit_patternkit_content_type_render(
431
394
}
432
395
else {
433
396
// Default ttl to 30 days.
434
- $ ttl = variable_get ('patternkit_default_module_ttl ' , 30 * 24 * 60 * 60 );
397
+ $ ttl = variable_get ('patternkit_default_module_ttl ' , PATTERNKIT_DEFAULT_TTL );
435
398
}
436
399
437
400
// Save to the cache bin (if caching is enabled).
@@ -880,7 +843,7 @@ function _patternkit_fetch_webcomponent_assets($subtype, $config, &$pk_obj) {
880
843
881
844
// Create the stub object.
882
845
$ pk_obj = (object ) array (
883
- 'pattern ' => $ subtype ,
846
+ 'PatternkitPattern ' => $ subtype ,
884
847
'attachments ' => array (),
885
848
'body ' => 'fragment.html ' ,
886
849
);
0 commit comments