Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit a343a163 authored by Abel Santos's avatar Abel Santos
Browse files

OEL-1280: Add paragraphs.inc.

parent 02678f9b
No related branches found
No related tags found
5 merge requests!121OEL-1421: Fix cosmetic changes.,!116OEL-1394: Merge 1.x into EPIC-1293-Project, align with new version of card:search pattern,!115Upate the EPIC-1293-project,!105EPIC: OEL-1255: Migrate paragraphs,!93[OEL-1255] OEL-1280: Copy and rename paragraph submodule from oe_bootstrap_theme
<?php
/**
* @file
* Theme functions for paragraphs.
*/
declare(strict_types = 1);
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function oe_whitelabel_theme_suggestions_paragraph_alter(array &$suggestions, array $variables): void {
/** @var \Drupal\paragraphs\ParagraphInterface $paragraph */
$paragraph = $variables['elements']['#paragraph'];
if ($paragraph->bundle() === 'oe_content_row') {
$variant = $paragraph->get('oe_paragraphs_variant')->first()->value;
$suggestions[] = 'paragraph__' . $paragraph->bundle() . '__variant_' . $variant;
}
}
...@@ -11,6 +11,14 @@ use Drupal\Core\Form\FormStateInterface; ...@@ -11,6 +11,14 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages; use Drupal\oe_whitelabel_helper\EuropeanUnionLanguages;
// Include all files from the includes directory.
$includes_path = __DIR__ . '/includes/*.inc';
foreach (glob($includes_path) as $filename) {
// The inspection disallowing basename() is not relevant for known paths.
// phpcs:ignore QualityAssurance.Functions.DrupalWrappers.FoundWithAlternative
require_once __DIR__ . '/includes/' . basename($filename);
}
/** /**
* Implements hook__preprocess_links__language_block(). * Implements hook__preprocess_links__language_block().
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment