From b7816b33b279c507ca84a30ffda9c92d095a0cec Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Tue, 10 Mar 2015 14:52:51 -0300 Subject: [PATCH] Option to not render breadcrumbs. --- includes/admin.form.inc | 6 ++++++ includes/breadcrumb.inc | 11 +++++++---- islandora.install | 7 +++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/includes/admin.form.inc b/includes/admin.form.inc index 51116f5c..cf0b8f69 100644 --- a/includes/admin.form.inc +++ b/includes/admin.form.inc @@ -74,6 +74,12 @@ function islandora_repository_admin(array $form, array &$form_state) { '#description' => t('Displays an extra print tab, allowing an object to be printed'), '#default_value' => variable_get('islandora_show_print_option', FALSE), ), + 'islandora_render_drupal_breadcrumbs' => array( + '#type' => 'checkbox', + '#title' => t('Render Drupal breadcrumbs'), + '#description' => t('Larger sites may experience a notable performance improvement when disabled due to how breadcrumbs are constructed.'), + '#default_value' => variable_get('islandora_render_drupal_breadcrumbs', TRUE), + ), ), 'islandora_namespace' => array( '#type' => 'fieldset', diff --git a/includes/breadcrumb.inc b/includes/breadcrumb.inc index e3eb2782..38c0970e 100644 --- a/includes/breadcrumb.inc +++ b/includes/breadcrumb.inc @@ -25,10 +25,13 @@ * drupal_set_breadcrumb(). */ function islandora_get_breadcrumbs($object) { - $breadcrumbs = islandora_get_breadcrumbs_recursive($object->id, $object->repository); - array_pop($breadcrumbs); - $context = 'islandora'; - drupal_alter('islandora_breadcrumbs', $breadcrumbs, $context, $object); + $breadcrumbs = array(); + if (variable_get('islandora_render_drupal_breadcrumbs', TRUE)) { + $breadcrumbs = islandora_get_breadcrumbs_recursive($object->id, $object->repository); + array_pop($breadcrumbs); + $context = 'islandora'; + drupal_alter('islandora_breadcrumbs', $breadcrumbs, $context, $object); + } return $breadcrumbs; } diff --git a/islandora.install b/islandora.install index 12c92009..a2151767 100644 --- a/islandora.install +++ b/islandora.install @@ -47,6 +47,13 @@ function islandora_uninstall() { $variables = array( 'islandora_ds_replace_exclude_enforced', 'islandora_defer_derivatives_on_ingest', + 'islandora_base_url', + 'islandora_repository_pid', + 'islandora_use_datastream_cache_headers', + 'islandora_show_print_option', + 'islandora_render_drupal_breadcrumbs', + 'islandora_namespace_restriction_enforced', + 'islandora_pids_allowed', ); array_walk($variables, 'variable_del'); }