wing.admin.inc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * @file
  4. * Administrative functions for Wing.
  5. */
  6. function wing_page_info() {
  7. dsm(func_get_args(), __FUNCTION__);
  8. return 'Info';
  9. }
  10. /**
  11. * Form builder for Workflow add/edit.
  12. *
  13. * @param array $form
  14. * @param array $form_state
  15. * @param WingWorkflow $entity
  16. * @param string $op
  17. * @param string $entity_type
  18. * Should be 'wing_workflow'
  19. */
  20. function wing_workflow_form($form, &$form_state, $entity, $op, $entity_type) {
  21. dsm(func_get_args(), __FUNCTION__);
  22. field_attach_form($entity_type, $entity, $form, $form_state);
  23. $form = array_merge($form, $entity->editForm());
  24. $form['actions'] = array('#type' => 'actions');
  25. $form['actions']['submit'] = array(
  26. '#type' => 'submit',
  27. '#value' => t('Submit'),
  28. );
  29. return $form;
  30. }
  31. function wing_workflow_form_submit($form, &$form_state) {
  32. $workflow = entity_ui_form_submit_build_entity($form, $form_state);
  33. $workflow->status |= ENTITY_CUSTOM;
  34. $workflow->save();
  35. dsm($workflow, 'Post save');
  36. $path = $workflow->entityInfo['admin ui']['path'];
  37. $form_state['redirect'] = $path;
  38. }
  39. function wing_settings_form($form, &$form_state) {
  40. dsm(get_defined_vars(), __FUNCTION__);
  41. return array();
  42. }