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
/** | |
* Gets a title from the field_headline first and falls back on the node | |
* title, then truncates the site name (/admin/config/system/site-information). | |
* - Stays under 58 characters, as that is best for SEO | |
* - Used for <title> and <meta name="title" content="xxxxxx">. | |
* - Will truncate the page title, and always add the full ' | site-name'. | |
* - Example output: <meta name="title" content="Homepage | MyCompany, Inc."> | |
* @param string $raw_title | |
* @param string $site_name | |
* @return string truncated and joined title string up to 58 characters |
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($node) { | |
// we have a node, so use headline in hero, or fall back to node title | |
if($node->field_hero_section && $node->field_hero_section->getValue() && $node->field_hero_section->getValue()[0]) { | |
$paragraph = $node->field_hero_section->getValue()[0]; | |
$paragraph_entity = \Drupal\paragraphs\Entity\Paragraph::load( $paragraph['target_id'] ); | |
return $paragraph_entity->field_headline->value; | |
} else { | |
return $node->getTitle(); | |
} | |
} |
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
{% set alternating_class = (_context.elements['#paragraph']._referringItem.getName()) % 2 ? ' teaser__container--inverse' : '' %} |
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
ffmpeg -i movie.mp4 -vf eq=brightness=0.1 -c:a copy movie-brighter.mp4 |
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
$query = \Drupal::entityQuery('node'); | |
$node_ids = $query | |
->condition('status', 1) | |
->exists('field_sidebar') | |
->execute(); | |
$count_fixed = 0; | |
$node_ids_with_related_links = []; |
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
$query = \Drupal::entityQuery('node'); | |
$node_ids = $query | |
->condition('status', 1) | |
->exists('field_sidebar') | |
->execute(); | |
$all_nodes_JSON = []; | |
foreach($node_ids as $node_id) { |
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
$query = \Drupal::entityQuery('node'); | |
$node_ids = $query | |
->condition('status', 1) | |
->exists('field_form_reference') | |
->execute(); | |
foreach($node_ids as $node_id) { | |
$node = \Drupal\node\Entity\Node::load($node_id); | |
$referenced_form = $node->get('field_form_reference')->referencedEntities(); |
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
use Drupal\paragraphs\Entity\Paragraph; | |
$query = \Drupal::entityQuery('node'); | |
// get all blogs with the flexible content field | |
$node_ids = $query | |
->condition('status', 1) | |
->condition('type','insight') | |
->exists('field_flexible_content') | |
->execute(); |
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 | |
// Single | |
use Drupal\node\Entity\Node; | |
$node = Node::load(1537); | |
$node->set('field_include_pop_up_form',0); // 0 to uncheck, 1 to check | |
$node->save(); | |
drupal_set_message($node->get('field_include_pop_up_form')->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
<!-- https://www.ostraining.com/blog/coding/responsive-videos/ --> | |
<div class="video-responsive"> | |
<iframe width="420" height="315" src="http://www.youtube.com/embed/6xisazZX9bA" frameborder="0" allowfullscreen></iframe> | |
</div> | |
<style> | |
.video-responsive{ | |
overflow:hidden; | |
padding-bottom:56.25%; |
OlderNewer