You are here

function ctools_custom_content_type_edit_form_submit in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/content_types/custom/custom.inc \ctools_custom_content_type_edit_form_submit()

The submit form stores the data in $conf.

File

plugins/content_types/custom/custom.inc, line 440
Custom content type.

Code

function ctools_custom_content_type_edit_form_submit($form, &$form_state) {

  // Because of changes in filter form, these two keys are out of position:
  $form_state['values']['format'] = $form_state['values']['body']['format'];
  $form_state['values']['body'] = $form_state['values']['body']['value'];
  if ($form_state['settings']['custom_type'] == 'fixed') {
    _ctools_custom_content_type_edit_save($form_state['settings']['content'], $form_state);
  }
  elseif (!empty($form_state['values']['reusable'])) {
    $content = ctools_export_crud_new('ctools_custom_content');
    $content->name = $form_state['values']['name'];
    _ctools_custom_content_type_edit_save($content, $form_state);
    $form_state['conf']['name'] = $content->name;
  }
  else {

    // Otherwise, just save values into $conf normally.
    foreach (array_keys($form_state['plugin']['defaults']) as $key) {
      $form_state['conf'][$key] = isset($form_state['values'][$key]) ? $form_state['values'][$key] : $form_state['plugin']['defaults'][$key];
    }
  }
}