paragraphs_bundles-1.0.x-dev/modules/paragraph_bundle_block_content/paragraph_bundle_block_content.module

modules/paragraph_bundle_block_content/paragraph_bundle_block_content.module
<?php

/**
 * @file
 * Paragraph Bundle Block Content.
 *
 * Filename:     paragraph_bundle_block_content.module
 * Website:      https://www.flashwebcenter.com
 * Description:  template.
 * Developer:    Alaa Haddad https://www.alaahaddad.com.
 */

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function paragraph_bundle_block_content_help($route_name, RouteMatchInterface $route_match) {
  if ($route_name === 'help.page.paragraph_bundle_block_content') {
    return paragraphs_bundles__helper_render_readme();
  }
  return NULL;
}

/**
 * Implements hook_theme() for the paragraph_bundle_block_content submodule.
 */
function paragraph_bundle_block_content_theme($existing, $type, $theme, $path) {
  $template_directory = \Drupal::service('extension.path.resolver')->getPath('module', 'paragraphs_bundles') . '/templates';

  return [
    'paragraph__block_content_bundle' => [
      'base hook' => 'paragraph',
      'template' => 'paragraph--default',
      'path' => $template_directory,
    ],
  ];
}

/**
 * Implements hook_theme_suggestions_paragraph_alter() for block content.
 */
function paragraph_bundle_block_content_theme_suggestions_paragraph_alter(array &$suggestions, array $variables) {
  /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
  $paragraph = $variables['elements']['#paragraph'];
  $bundle = $paragraph->bundle();

  // Add a template suggestion for paragraphs of type 'block_content_bundle'.
  if ($bundle === 'block_content_bundle') {
    $suggestions[] = 'paragraph__block_content_bundle';
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc