0

We're running Drupal 7.65 and Alfresco 5.2.4. We've the ability to display CMIS content (hosted in Alfresco) by fetching a URI like: https://domain.com/cmis/browser?id=<node_ID>. Doing so allow users who doesn't have access to Alfresco to download a file (if node_ID refers to a file) or browse the content of a directory (if node_ID refers to a directory).

Issue: sharing a directory via this method allow users to navigate the whole content of Alfresco by navigating the breadcrumb.

example of CMIS content from Alfresco display by Drupal

We'd like to remove this breadcrumb, could you recommend ways to do it ?

Here's what we've been thiking at:

  • Ideally, find a Drupal/Alfresco setting that allow us to restrict display
  • Comment out the line(s) responsible of displaying this breadcrumb inside Drupal' source code
  • less ideally, filter the DOM through JS (document.getElementById('cmis-breadcrumb').innerHTML = '')

Apologies for my English and the lack of knowledge about CMIS and Drupal

edit 19/01/2021: I believe I've found the module & the function responsible for the breadcrumb: https://git.drupalcode.org/project/cmis/-/blob/7.x-1.x/cmis_browser/cmis_browser.theme.inc#L125

2
  • 1
    The goal is just to hide the breadcrumb, not to actually restrict access to the files? – Patrick Kenny Jan 18 at 16:12
  • Yes indeed, we'd like to remove the breadcrumb – Sumak Jan 19 at 7:55
1

CMIS Browser, a submodule of CMIS API, handles CMIS links. We are using CMIS API v7.x.x.

Here's the function responsible for the breadcrumb:

# cmis/cmis_browser/cmis_browser.theme.inc #125

function theme_cmis_browser_browse_breadcrumb($variables) {

  $next_img = theme('image', array('path' => drupal_get_path('module', 'cmis_browser') .'/images/next.gif'));
  $contents = '';
  $currentpath = '';

  $contents .= '<div id="cmis-breadcrumb">';
  if (!empty($_GET['type']) && $_GET['type'] == 'popup') {
    $contents .= l('Root', 'cmis/browser'. $currentpath, array('query' => array('type' => 'popup', 'caller' => $_GET['caller'])));
  }
  else {
    $contents .= l('Root', 'cmis/browser'. $currentpath);
  }

  $currentpath = '';
  foreach ($variables['bcarray'] as $space) {
    $contents .= $next_img .' ';
    $currentpath .= '/'. $space;
    if (!empty($_GET['type']) && $_GET['type'] == 'popup') {
      $pagelink = l($space, 'cmis/browser'. $currentpath, array('query' => array('type' => 'popup', 'caller' => $_GET['caller'])));
    }
    else {
      $pagelink = l($space, 'cmis/browser'. $currentpath);
    }
    $contents .= $pagelink;
  }

  $contents .= '</div>';

  return $contents;
}

Our workaround is simply to return an empty <div> earlier:


function theme_cmis_browser_browse_breadcrumb($variables) {
  return '<div id="removed-breadcrumb"></div>';
  
  .....
}

Be careful since it's not a persistent solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.