You are here

function panels_content_config_add_form_submit in Panels 5.2

File

includes/display_edit.inc, line 1140

Code

function panels_content_config_add_form_submit($form_values, $cache, $pane) {
  $ajax_vars = new stdClass();
  $ajax_vars->type = 'add';
  $ajax_vars->region = $cache->content_config[$pane->pid]['panel_id'];
  $cache->display->panels[$cache->content_config[$pane->pid]['panel_id']][] = $pane->pid;
  $cache->display->content[$pane->pid]->shown = TRUE;

  // we need to fake the buttons a little.
  // new panes are shown by default
  $buttons['configure'] = panels_add_button('icon-configure.png', t('Configure'), t('Configure this pane'), 'pane-configure');
  $buttons['configure']['#parents'] = array(
    'button',
    $pane->pid,
    'configure',
  );
  if (panels_get_caches() && user_access('use panels caching features')) {
    $buttons['cache'] = panels_add_button('icon-cache.png', t('Caching'), t('Control caching'), 'pane-cache');
    $buttons['cache']['#parents'] = array(
      'button',
      $pane->pid,
      'cache',
    );
  }
  $buttons['show_hide'] = panels_add_button('icon-hidepane.png', t('Show/Hide Toggle'), t('Hide this pane'), 'pane-toggle-shown');
  $buttons['show_hide']['#parents'] = array(
    'button',
    $pane->pid,
    'show_hide',
  );
  $buttons['delete'] = panels_add_button('icon-delete.png', t('Delete'), t('Remove this pane'), 'pane-delete');
  $buttons['delete']['#parents'] = array(
    'button',
    $pane->pid,
    'delete',
  );
  $buttons = form_builder('dummy', $buttons);

  // Render the new pane for the javascript.
  $ajax_vars->output = panels_show_pane($cache->display, $cache->display->content[$pane->pid], NULL, drupal_render($buttons));
  return $ajax_vars;
}