Initial Drupal 11 with DDEV setup
This commit is contained in:
		@ -0,0 +1,54 @@
 | 
			
		||||
{% import '@lib/di.twig' as di %}
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace Drupal\{{ machine_name }};
 | 
			
		||||
 | 
			
		||||
{% apply sort_namespaces %}
 | 
			
		||||
use Drupal\Core\Breadcrumb\Breadcrumb;
 | 
			
		||||
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
 | 
			
		||||
use Drupal\Core\Link;
 | 
			
		||||
use Drupal\Core\Routing\RouteMatchInterface;
 | 
			
		||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
 | 
			
		||||
  {% if services %}
 | 
			
		||||
{{ di.use(services) }}
 | 
			
		||||
  {% endif %}
 | 
			
		||||
{% endapply %}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @todo Add description for this breadcrumb builder.
 | 
			
		||||
 */
 | 
			
		||||
final class {{ class }} implements BreadcrumbBuilderInterface {
 | 
			
		||||
 | 
			
		||||
  use StringTranslationTrait;
 | 
			
		||||
{% if services %}
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Constructs {{ class|article }} object.
 | 
			
		||||
   */
 | 
			
		||||
  public function __construct(
 | 
			
		||||
{{ di.signature(services) }}
 | 
			
		||||
  ) {}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function applies(RouteMatchInterface $route_match): bool {
 | 
			
		||||
    return $route_match->getRouteName() === 'example';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  public function build(RouteMatchInterface $route_match): Breadcrumb {
 | 
			
		||||
    $breadcrumb = new Breadcrumb();
 | 
			
		||||
 | 
			
		||||
    $links[] = Link::createFromRoute($this->t('Home'), '<front>');
 | 
			
		||||
    $links[] = Link::createFromRoute($this->t('Example'), '<none>');
 | 
			
		||||
 | 
			
		||||
    return $breadcrumb->setLinks($links);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								vendor/chi-teck/drupal-code-generator/templates/Service/_breadcrumb-builder/services.twig
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								vendor/chi-teck/drupal-code-generator/templates/Service/_breadcrumb-builder/services.twig
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
			
		||||
{% import '@lib/di.twig' as di %}
 | 
			
		||||
services:
 | 
			
		||||
  {{ machine_name }}.breadcrumb:
 | 
			
		||||
    class: Drupal\{{ machine_name }}\{{ class }}
 | 
			
		||||
{% if services %}
 | 
			
		||||
    arguments: [{{ di.arguments(services) }}]
 | 
			
		||||
{% endif %}
 | 
			
		||||
    tags:
 | 
			
		||||
      # In order to override breadcrumbs built with PathBasedBreadcrumbBuilder
 | 
			
		||||
      # set the priority higher than zero.
 | 
			
		||||
      - { name: breadcrumb_builder, priority: 1000 }
 | 
			
		||||
		Reference in New Issue
	
	Block a user