You are here

function panels_content_config_form_submit in Panels 6.2

Same name and namespace in other branches
  1. 5.2 includes/display_edit.inc \panels_content_config_form_submit()

FAPI submission function for the edit content form.

All this does is set up $pane properly. The caller is responsible for actually storing this somewhere.

Related topics

File

includes/display-edit.inc, line 645

Code

function panels_content_config_form_submit($form, &$form_state) {
  $pane =& $form_state['pane'];
  $display = $form_state['display'];
  panels_ct_pane_submit_form($pane->type, $form_state['values']['configuration'], $form_state['op']);
  if (isset($form_state['values']['visibility'])) {
    if ($visibility_submit = panels_plugin_get_function('content_types', $form_state['type'], 'visibility submit')) {

      // Use call_user_func_array() in order to ensure that all these values
      // can only be passed by value.
      $pane->visibility = call_user_func_array($visibility_submit, array(
        $form_state['values']['visibility'],
        $form_state['op'] == 'add',
        $pane,
        $display,
      ));
    }
    else {

      // If no visibility submit callback is defined, fall back to the
      // default storage behavior. Should be adequate for the vast majority
      // of use cases, so most client modules won't need to define callbacks.
      ${$pane}->visibility = is_array($form_state['values']['visibility']) ? array_keys(array_filter($form_state['values']['visibility'])) : $form_state['values']['visibility'];
    }
  }
  if (isset($form_state['values']['access'])) {
    $pane->access = array_keys(array_filter($form_state['values']['access']));
  }
  else {
    $pane->access = array();
  }
  $pane->configuration = $form_state['values']['configuration'];
}