You are here

function panels_breadcrumbs_panelizer_breadcrumbs_entity_page in Panels Breadcrumbs 7.2

Panelizer breadcrumbs operation entity page callback.

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

File

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

Code

function panels_breadcrumbs_panelizer_breadcrumbs_entity_page($handler, $js, $input, $entity, $view_mode) {
  $panelizer = $entity->panelizer[$view_mode];
  if (empty($panelizer)) {
    return MENU_NOT_FOUND;
  }
  list($entity_id, $revision_id, $bundle) = entity_extract_ids($handler->entity_type, $entity);
  $form_state = array(
    'entity' => $entity,
    'revision info' => $handler
      ->entity_allows_revisions($entity),
    'display cache' => panels_edit_cache_get(implode(':', array(
      'panelizer',
      $handler->entity_type,
      $entity_id,
      $view_mode,
    ))),
    '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) {
        $entity->panelizer[$view_mode]->extra[$key] = $form_state['values'][$key];
      }
      $handler
        ->entity_save($entity);
    }
    else {
      drupal_set_message(t('Changes have been discarded.'));
    }
    drupal_goto($_GET['q']);
  }
  $output = $handler
    ->wrap_entity_panelizer_pages($entity, $view_mode, $output);
  ctools_set_no_blocks(FALSE);
  drupal_set_page_content($output);
  $page = element_info('page');
  return $page;
}