This file contains hidden or 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
{% if paragraph.field_hide_spotlight.value != 1 %} | |
<{{ outer_wrapper }}{{ attributes.addClass('ppl-spotlight-wrapper', 'ds-2col-stacked', 'clearfix') }}> | |
{{ title_suffix.contextual_links }} | |
<{{ header_wrapper }}{{ header_attributes.addClass('group-header') }}> | |
{{ header }} | |
</{{ header_wrapper }}> | |
<{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> |
This file contains hidden or 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
{% if content.field_myfield is not empty %} | |
{% endif %} | |
https://www.drupal.org/forum/support/theme-development/2016-03-18/how-to-check-if-a-field-value-is-empty |
This file contains hidden or 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
You might be using a link field on your entity type, and if so, you might find yourself in a position where you require the exact URL from the link reference field. | |
{{ content.field_custom_link.0['#url'] }} | |
If you need the title, use this instead: | |
{{ content.field_custom_link.0['#title'] }} | |
Be sure to switch out the bolded text above for the machine name of your custom link field. |
This file contains hidden or 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
//place this code into the browser's console | |
var docWidth = document.documentElement.offsetWidth; | |
[].forEach.call( | |
document.querySelectorAll('*'), | |
function(el) { | |
if (el.offsetWidth > docWidth) { | |
console.log(el); | |
} |
This file contains hidden or 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
{# Get URL of single file field #} | |
{{ node.field_file.entity.uri.value }} | |
{# Get URL of multi file field #} | |
{{ node.field_file['#items'].entity.uri.value }} | |
{# Trun into link #} | |
{{ file_url(node.field_file.entity.uri.value) }} | |
{# Check if there is at least one value #} |
This file contains hidden or 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
// HTML5 video element with button toggle | |
$('button').click(function () { | |
var mediaVideo = $("#myVideo").get(0); | |
if (mediaVideo.paused) { | |
mediaVideo.play(); | |
$('.pause').show(); | |
$('.play').hide(); | |
} else { | |
$('.play').show(); |
This file contains hidden or 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
$(document).ready(function(){ | |
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { | |
$('.carousel-div').attr('data-interval', 'false'); | |
} | |
}); |
This file contains hidden or 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 | |
// Import arbitrary config from a variable. | |
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html'); | |
$config->setData($data)->save(); | |
// Or, re-import the default config for a module or profile, etc. | |
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module'); | |
// Or, import YAML config an arbitrary directory. |
This file contains hidden or 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
name = Oog Email Formatter | |
description = Replaces actual email address with the word "email" | |
core = 7.x |