Hi, since Omega 3 doesn't seem to support setting the custom breadcrumb separator anymore, I tried to customize it by these instructions: http://fusiondrupalthemes.com/forum/using-fusion/customize-breadcrumb-se...

function THEMENAME_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
    return '<div class="breadcrumb">'. implode(' | ', $breadcrumb) .'</div>';
  }
}

But instead of a custom separator, I get a 'Array to String Conversion' error... Anyone has a way to get this working with Omega?

Comments

tahiticlic’s picture

mixhael’s picture

tnx. Tried that thought, but the breadcrumb remains unaffected.

Put in template.php:

function mythemename_breadcrumb($variables) {
  $breadcrumb = $variables['breadcrumb'];

  if (!empty($breadcrumb)) {
    // Provide a navigational heading to give context for breadcrumb links to
    // screen-reader users. Make the heading invisible with .element-invisible.
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
    $output .= '<div class="breadcrumb">' . implode(' // ', $breadcrumb) . '</div>';
  }

  return $output;
}

Even when replacing it with, nothing happens...:

function mythemename_breadcrumb($variables) {
  return "?????";
}
mixhael’s picture

I'm using the breadcrumb block in order to position my breadcrumbs. Maybe that's why?

tahiticlic’s picture

Yes, there's a proper theming function for this block.

mixhael’s picture

Ok tnx, can you give me some directions on that? No clue where to start...

daniel wentsch’s picture

Seems to be theme_delta_blocks_breadcrumb() in delta/delta_blocks/includes/delta_blocks.theme.inc
You can copy (and rename!) this function to your template.php and override it.

mixhael’s picture

Tried that:

function mythemename_delta_blocks_breadcrumb($variables) {
  $breadcrumb = $variables['breadcrumb'];

  if (!empty($breadcrumb)) {
    // Provide a navigational heading to give context for breadcrumb links to
    // screen-reader users. Make the heading invisible with .element-invisible.
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
    $output .= '<div class="breadcrumb">' . implode(' // ', $breadcrumb) . '</div>';
  }

  return $output;
}

Nothing changes :(

mecielle’s picture

It worked for me. This is what I used.

function mytheme_delta_blocks_breadcrumb($variables) {
  $output = '';
   
  if (!empty($variables['breadcrumb'])) {  
    if ($variables['breadcrumb_current']) {
      $variables['breadcrumb'][] = l(drupal_get_title(), current_path(), array('html' => TRUE));
    }
  
    $output = '<div id="breadcrumb" class="clearfix"><ul class="breadcrumb">';
    $switch = array('odd' => 'even', 'even' => 'odd');
    $zebra = 'even';
    $last = count($variables['breadcrumb']) - 1;    
    
    foreach ($variables['breadcrumb'] as $key => $item) {
      $zebra = $switch[$zebra];
      $attributes['class'] = array('depth-' . ($key + 1), $zebra);
      
      if ($key == 0) {
        $attributes['class'][] = 'first';
      }
      
      if ($key == $last) {
        $attributes['class'][] = 'last';
		$output .= '<li' . drupal_attributes($attributes) . '>' . $item . '</li>' . '';
      }
	  
	  else

      $output .= '<li' . drupal_attributes($attributes) . '>' . $item . '</li>' . '-> ';
    }
      
    $output .= '</ul></div>';
  }
mecielle’s picture

Now if someone can explain how to add the title attribute to the link, that would be real nice.

mixhael’s picture

Tnx alot! It works :)

tahiticlic’s picture

<?php
l(drupal_get_title(), current_path(), array('html' => TRUE,'attributes'=>array('title'=>'Your Title')));
?>
samwillc’s picture

Get a parse error with this one :(

Seems there might be one curly bracket short according to notepad++, the first one at the end of:

function mytheme_delta_blocks_breadcrumb($variables) {

has no end one.

Sam.

marcoka’s picture

Status: Active » Postponed (maintainer needs more info)

you know that "mythemename" must be replaced with the name of your subtheme (just to be sure).

samwillc’s picture

Lol, yeah did that :)

Never did sort this out, used css3 :after instead to add the separator. The code above didn't work for me.

Sam.

himerus’s picture

The code above assumed you were using the Delta module's block implementation of the breadcrumb.

samwillc’s picture

Hi himerus,

Yes, I do use it as a block but the above still didn't work. I put the above between the tags correctly and I got a parse error.

I'm no expert but counting the curly brackets, if each of those needs an opening AND closing one, there is one short. There's 6 opening and 5 closing.

Not sure if that's the problem.

Sam.

marcoka’s picture

i just tested both
screen: http://screensnapr.com/v/40GK4e.jpg

its /user so a core path. the first breadcrumbbar is core the second is delta. I am not sure why the delta block gets the breadcrumb and the core does not. I am only using delta so its not important to me. But that could be related to the issues.

SAMPLE TEST template.php code

function seov3_delta_blocks_breadcrumb($variables) {
  $output = '';

  if (!empty($variables['breadcrumb'])) {
    if ($variables['breadcrumb_current']) {
      $variables['breadcrumb'][] = l(drupal_get_title(), current_path(), array('html' => TRUE));
    }

    $output = '<div id="breadcrumb" class="clearfix"><ul class="breadcrumb">';
    $switch = array('odd' => 'even', 'even' => 'odd');
    $zebra = 'even';
    $last = count($variables['breadcrumb']) - 1;

    foreach ($variables['breadcrumb'] as $key => $item) {
      $zebra = $switch[$zebra];
      $attributes['class'] = array('depth-' . ($key + 1), $zebra);

      if ($key == 0) {
        $attributes['class'][] = 'first';
      }

      if ($key == $last) {
        $attributes['class'][] = 'last';
      }

      $output .= '<li' . drupal_attributes($attributes) . '>' . $item . ' > </li>';
    }

    $output .= '</ul></div>';
  }

  if (drupal_is_front_page()) {
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';

    $output .= '<div class="breadcrumb">Startseite</div>';
 }

  return $output;
}


function seov3_breadcrumb($variables) {
  $breadcrumb = $variables['breadcrumb'];

  if (!empty($breadcrumb)) {
    // Provide a navigational heading to give context for breadcrumb links to
    // screen-reader users. Make the heading invisible with .element-invisible.
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';

    $output .= '<div class="breadcrumb">' . implode(' » ', $breadcrumb) . '</div>';
    return $output;
  }
}
marcoka’s picture

if you want the "Home" link to always appear and add a delimter with delta just use something like:

function seov3_delta_blocks_breadcrumb($variables) {
  $output = '';

  if (!empty($variables['breadcrumb'])) {
    if ($variables['breadcrumb_current']) {
      $variables['breadcrumb'][] = l(drupal_get_title(), current_path(), array('html' => TRUE));
    }

    $output = '<div id="breadcrumb" class="clearfix"><ul class="breadcrumb">';
    $switch = array('odd' => 'even', 'even' => 'odd');
    $zebra = 'even';
    $last = count($variables['breadcrumb']) - 1;

    foreach ($variables['breadcrumb'] as $key => $item) {
      $zebra = $switch[$zebra];
      $attributes['class'] = array('depth-' . ($key + 1), $zebra);

      if ($key == 0) {
        $attributes['class'][] = 'first';
      }

      if ($key == $last) {
        $attributes['class'][] = 'last';
        $output .= '<li' . drupal_attributes($attributes) . '><span id="breadcrumb-delimiter">►</span>' . $item . '</li>' . '';
      }

      else {
        $output .= '<li' . drupal_attributes($attributes) . '>' . $item . '</li>';
      }
    }

    $output .= '</ul></div>';
  }

  if (drupal_is_front_page()) {
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
    $output .= '<div class="breadcrumb">Frontpage</div>';
 }

  return $output;
}
samwillc’s picture

Thanks e-anima, that's really helpful.

Sam.

kclarkson’s picture

My problem is that I the Delta Block separator does not match the core. I would like to have the mini >> separators or event add a custom image. Nothing changes when I add it to the code.

steinmb’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (fixed)
Issue tags: -breadcrumb, -custom breadcrumbs, -omega theme

Old and messy. Housekeeping, closing this. Please create a new issues if you still have question.

fawad ali’s picture

its work for me

function mythemename_delta_blocks_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];

if (!empty($breadcrumb)) {
// Provide a navigational heading to give context for breadcrumb links to
// screen-reader users. Make the heading invisible with .element-invisible.
$output = '' . t('You are here') . '';
$output .= '' . implode(' // ', $breadcrumb) . '';
}

return $output;
}