0

I have written a custom block and put it inside the panel of "Add Content" page, but it can not change the breadcrumb. Actually the code in module includes drupal_set_breadcrumb() function, which doesn't work on “Add content” pages. My code is working on the others pages!

I need your help to change only the breadcrumb of each "Add content" page without using the available modules for drupal breadcrumb. Because I have written my code and the customization level is so high which can not be obtained with those modules.

0

Ok, I just solved it! It's too easy! Using the below function in template.php file:

function mytheme_breadcrumb($variables) {
  $sep = ' > ';
  if (count($variables['breadcrumb']) > 0) {
    return implode($sep, $variables['breadcrumb']) . $sep;
  }
  else {
    return t("Home");
  }
}

and using the arg() values and $variables['breadcrumb'] values in above function can enable you to check every pages path. Such as adding the below piece of code the above function:

  $breadcrumb = $variables['breadcrumb'];

  $is_add_content=false;
  foreach($breadcrumb as $key=>$value){
    if(strpos($value,"node/add"))
      $is_add_content=true;
  }

References:

https://www.drupal.org/node/64067 https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_breadcrumb/7

| improve this answer | |

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.