You are here

panels_breadcrumbs.module in Panels Breadcrumbs 8

Same filename and directory in other branches
  1. 7.2 panels_breadcrumbs.module
  2. 7 panels_breadcrumbs.module

Module file for panels breadcrumbs module.

File

panels_breadcrumbs.module
View source
<?php

/**
 * @file
 * Module file for panels breadcrumbs module.
 */
use Drupal\panels_breadcrumbs\Form\PageVariantBreadcrumbsForm;

/**
 * Implements hook_page_manager_variant_operations_alter().
 */
function panels_breadcrumbs_page_manager_variant_operations_alter(&$operations) {
  $operations['breadcrumbs'] = [
    'title' => t('Breadcrumbs'),
    'form' => PageVariantBreadcrumbsForm::class,
  ];
}

/**
 * Implements hook_system_breadcrumb_alter().
 */
function panels_breadcrumbs_system_breadcrumb_alter(&$breadcrumb, &$route_match, &$context) {
  if ($page_variant = $route_match
    ->getParameter('page_manager_page_variant')) {
    $variant_settings = $page_variant
      ->get('variant_settings');
    if (array_key_exists('panels_breadcrumbs', $variant_settings) && $variant_settings['panels_breadcrumbs']['state'] == 1) {
      $breadcrumb = \Drupal::service('panels_breadcrumbs.breadcrumb')
        ->build($route_match);
    }
  }
}

Functions

Namesort descending Description
panels_breadcrumbs_page_manager_variant_operations_alter Implements hook_page_manager_variant_operations_alter().
panels_breadcrumbs_system_breadcrumb_alter Implements hook_system_breadcrumb_alter().