How can I add breadcrumb to a page in my attendance module.
I have used the following hook, but it changed the breadcrumb for all pages in other modules also.
function attendance_init() {
// set the breadcrumb
$breadcrumb = array();
$breadcrumb[] = l('Home', '<front>');
$breadcrumb[] = l('People', 'group/node/'. arg(2) .'/people');
$breadcrumb[] = l('Attendance', 'group/node/'. arg(2) .'/people/attendance');
drupal_set_breadcrumb($breadcrumb);
}
Method 1: By Using the react-router-dom Library With the react-router-dom library, you can manually create breadcrumbs for every path in your React application. The library provides a <Link> component that can be used to create breadcrumbs. export default Breadcrumbs; There are different types of hooks in React.
But have you heard about breadcrumbing? “In a relationship context, breadcrumbing refers to a person who gives you just enough 'crumbs' of attention or affection to give you hope and keep you on the hook — but not enough to make you feel comfortable or assured the relationship is going well,” explains Dr.
You also see them in Web applications that have more than one step, where they function similar to a progress bar. In their simplest form, breadcrumbs are horizontally arranged text links separated by the “greater than” symbol (>); the symbol indicates the level of that page relative to the page links beside it.
If you are trying to change the breadcrumb for a specific content type nodes, try to use hook_node_view_alter()
Here's an example:
function attendance_node_view_alter(&$build)
{
$node = $build['#node'];
if($build['#view_mode'] == "full" && $node->type == "attendance")
{
$breadcrumb = array();
$breadcrumb[] = l('Home', '<front>');
$breadcrumb[] = l('People', 'group/node/'. arg(2) .'/people');
$breadcrumb[] = l('Attendance', 'group/node/'. arg(2) .'/people/attendance');
drupal_set_breadcrumb($breadcrumb);
}
}
Hope this works... Muhammad
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With