You are here

function panels_breadcrumbs_panelizer_breadcrumbs_admin_page in Panels Breadcrumbs 7.2

Panelizer breadcrumbs operation admin page callback.

1 string reference to 'panels_breadcrumbs_panelizer_breadcrumbs_admin_page'
panels_breadcrumbs_panelizer_operations_alter in ./panels_breadcrumbs.module
Implements hook_panelizer_operations_alter().

File

./panels_breadcrumbs.module, line 432
Main file for panels breadcrumbs module.

Code

function panels_breadcrumbs_panelizer_breadcrumbs_admin_page($handler, $bundle, $name, $view_mode) {
  if (is_string($handler)) {
    $handler = panelizer_entity_plugin_get_handler($handler);
  }
  if ($view_mode) {
    $bundle .= '.' . $view_mode;
  }
  $panelizer = $handler
    ->get_default_panelizer_object($bundle, $name);
  if (empty($panelizer)) {
    return MENU_NOT_FOUND;
  }
  $cache_key = 'panelizer:default:' . $handler->entity_type . ':' . $bundle . ':' . $name;
  $form_state = array(
    'display cache' => panels_edit_cache_get($cache_key),
    'no_redirect' => TRUE,
    'panelizer' => $panelizer,
  );
  ctools_include('common', 'panelizer');
  $output = drupal_build_form('panels_breadcrumbs_panelizer_breadcrumbs_form', $form_state);
  if (!empty($form_state['executed'])) {
    if ($form_state['clicked_button']['#name'] == 'save') {
      drupal_set_message(t('The settings have been updated.'));
      $config_keys = _panels_breadcrumbs_config_keys();
      foreach ($config_keys as $key) {
        $panelizer->extra[$key] = $form_state['values'][$key];
      }
      ctools_export_crud_save('panelizer_defaults', $panelizer);
    }
    else {
      drupal_set_message(t('Changes have been discarded.'));
    }
    drupal_goto($_GET['q']);
  }
  ctools_set_no_blocks(FALSE);
  if ($view_mode) {
    $output = $handler
      ->wrap_default_panelizer_pages($bundle, $output);
  }
  drupal_set_page_content($output);
  $page = element_info('page');
  return $page;
}