1

How could I print content type like the breadcrumb, for example

Home/Content type/Create

0

It is possible using theme_breadcrumb().

Example:

/**
 * Implements theme_breadcrumb().
 */
function theme_breadcrumb($variables) {
  // global variable 
  $output = '';
  $breadcrumb = $variables['breadcrumb'];
  if (!empty($breadcrumb)) {
    $nid = arg(1);
    $node = node_load($nid);
    $output = '<ul class="breadcrumb">';
      $i = 1;
      foreach($breadcrumb as $value) {
        $output .= '<li class="breadcrumb-'.$i.'">'.$value.'</li>';
      $i++;
      }
      if ($node->type == 'content_type') {
        $output .= '<li><a href="' . url() . '" rel="breadcrumb">' .  $node->type . '</a></li>';
      }
    $output .= '<li class="active">'. drupal_get_title() .'</li>';
    $output .= '</ul>'; 
    return $output;
  }
}
  • @KirshaWeb Thanks for your suggestion... I have done the same concept. – tamil selvan Mar 2 '17 at 12:06

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.