This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\video_embed_field\Plugin\Field\FieldFormatter; | |
use Drupal\Core\Cache\CacheableMetadata; | |
use Drupal\Core\Entity\EntityStorageInterface; | |
use Drupal\Core\Field\FieldDefinitionInterface; | |
use Drupal\Core\Field\FormatterBase; | |
use Drupal\Core\Field\FieldItemListInterface; | |
use Drupal\Core\Form\FormStateInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\paragraphs\Entity\Paragraph; | |
/** | |
* Implements template_preprocess_node | |
* | |
* Add variables for paragraphs available to node templates | |
*/ | |
function CUSTOM_preprocess_node(&$variables) { | |
// Convenience Variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div{{ attributes }}> | |
{# First check if there is a section video #} | |
{% for item in items if item.content['#paragraph'].field_section_video is not null %} | |
{% if loop.first %} | |
<div{{ item.attributes }}>{{ item.content }}</div> | |
{% endif %} | |
{% else %} | |
{# If no video was found, check if there is a section_image #} | |
{% for item in items if item.content['#paragraph'].field_section_image is not null %} | |
{% if loop.first %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Kint | |
{{ kint(content.field_sections['#items'].getValue()) }} | |
#} | |
{# if field is defined | |
{% if node.field_sections[key].entity.field_section_image.entity.fileuri is defined %} | |
<img src="{{ node.field_sections[key].entity.field_section_image.entity.fileuri | image_style('large') }}"> | |
{% endif %} | |
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$view = new view(); | |
$view->name = 'sh_drupal_languages'; | |
$view->description = ''; | |
$view->tag = 'default'; | |
$view->base_table = 'node'; | |
$view->human_name = 'sh_drupal_languages'; | |
$view->core = 7; | |
$view->api_version = '3.0'; | |
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |