delta_ui.admin.inc 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * @file
  4. * Delta UI functionality
  5. */
  6. /**
  7. * @todo
  8. */
  9. function delta_ui_layout_configure($form, &$form_state, $delta) {
  10. module_load_include('inc', 'system', 'system.admin');
  11. $backup = delta_inject($delta->machine_name);
  12. $form_state['delta'] = $delta->machine_name;
  13. $form_state['build_info']['args'][0] = $delta->theme;
  14. $form = system_theme_settings($form, $form_state, $delta->theme);
  15. foreach (delta_get_plugins($delta->machine_name) as $plugin) {
  16. $plugin->form_alter($form, $form_state);
  17. }
  18. $form['delta'] = array(
  19. '#type' => 'markup',
  20. '#markup' => '<div class="messages warning">' . t('You are currently editing the Delta template %name. This template operates in %mode mode.', array('%name' => $delta->name, '%mode' => ($delta->mode == DELTA_PRESERVE ? t('Preserve') : t('Override')))) . '</div>',
  21. '#weight' => -999,
  22. );
  23. $form['#validate'][] = 'delta_ui_layout_configure_validate';
  24. $form['#submit'][] = 'delta_ui_layout_configure_submit';
  25. $form['#attributes']['id'] = 'system-theme-settings';
  26. delta_reset($delta->theme);
  27. delta_inject($backup);
  28. return $form;
  29. }
  30. /**
  31. * @todo
  32. */
  33. function delta_ui_layout_configure_validate($form, &$form_state) {
  34. foreach (delta_get_plugins($form_state['delta']) as $plugin) {
  35. $plugin->form_validate($form, $form_state);
  36. }
  37. }
  38. /**
  39. * @todo
  40. */
  41. function delta_ui_layout_configure_submit($form, &$form_state) {
  42. foreach (delta_get_plugins($form_state['delta']) as $plugin) {
  43. $plugin->form_submit($form, $form_state);
  44. }
  45. foreach (delta_get_plugins($form_state['delta']) as $plugin) {
  46. $plugin->presave($form, $form_state);
  47. }
  48. $delta = delta_load($form_state['delta']);
  49. ctools_export_crud_save('delta', $delta);
  50. }