function panels_content_config_form_submit in Panels 5.2
Same name and namespace in other branches
- 6.2 includes/display-edit.inc \panels_content_config_form_submit()
FAPI submit handler for panels_content_config_form().
Call any submit handlers defined by the content type, update the $cache object with the relevant data, save $cache to the object_cache table, and return data for ajax updates.
Return value
object $ajax_vars Variables to be passed to the ajax handler so that the overall edit form can be updated as needed.
File
- includes/
display_edit.inc, line 1101
Code
function panels_content_config_form_submit($form_id, $form_values) {
list($cache, $pane, $add, $op) = $form_values['vars'];
// Start by saving all initial $pane values into the array of pane data in $display->content.
$cache->display->content[$pane->pid] = $pane;
// Call the submit handler provided by the pane type, if any.
panels_ct_pane_submit_form($pane->type, $form_values['configuration'], $op);
if (isset($form_values['visibility'])) {
if ($visibility_submit = panels_plugin_get_function('content_types', $cache->content_config[$pane->pid]['ct_data']['type'], 'visibility submit')) {
// Use call_user_func_array() in order to ensure that all these values can only be passed by value.
$cache->display->content[$pane->pid]->visibility = call_user_func_array($visibility_submit, array(
$form_values['visibility'],
$add,
$cache->display->content[$pane->pid],
$cache->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.
$cache->display->content[$pane->pid]->visibility = is_array($form_values['visibility']) ? array_keys(array_filter($form_values['visibility'])) : $form_values['visibility'];
}
}
else {
$cache->display->content[$pane->pid]->visibility = '';
}
if (isset($form_values['access'])) {
$cache->display->content[$pane->pid]->access = array_keys(array_filter($form_values['access']));
}
else {
$cache->display->content[$pane->pid]->access = array();
}
$cache->display->content[$pane->pid]->configuration = $form_values['configuration'];
// Call submit handlers specific to the $op ('add' or 'edit').
$ajax_vars = call_user_func_array("panels_content_config_" . $op . "_form_submit", array(
$form_values,
&$cache,
$pane,
));
$ajax_vars->id = $pane->pid;
panels_cache_set($cache->display->did, $cache);
return $ajax_vars;
}