Skip to content

Instantly share code, notes, and snippets.

name: Modal Form Example
type: module
description: 'Modal Form Example module'
package: Example
version: VERSION
core: 8.x
@brooke-heaton
brooke-heaton / Drupal8_views_query_alter.php
Created August 11, 2017 22:13
Alters a Drupal 8 view by adding a Left Join and Where condition
<?php
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\query\QueryPluginBase;
/**
* Implementation of hook_views_query_alter
* @param type $view
* @param type $query
@bdlangton
bdlangton / Blocks.md
Last active October 12, 2023 08:40
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@nelson-ph
nelson-ph / filefield_paths_media_thumbnail_error.patch
Created May 18, 2018 14:07
Drupal 8 - Prevent Call to undefined method Drupal\\Core\\Field\\BaseFieldDefinition::getThirdPartySettings
Index: ./filefield_paths.module
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- ./filefield_paths.module (date 1517934386000)
+++ ./filefield_paths.module (date 1517934386000)
@@ -344,13 +344,15 @@
if ($field instanceof FileFieldItemList) {
/** @var FieldConfig $definition */
@megclaypool
megclaypool / The fix.md
Last active February 12, 2025 08:51
["Unable to unlink, Permission denied" Error] Solution for: ``` $ git pull error: unable to unlink old 'sites/default/default.settings.php': Permission denied ```

In this case, the specific error was:

$ git pull
error: unable to unlink old 'sites/default/default.settings.php': Permission denied

I opened the sites directory and saw the following:

$ lll
  rwxr-xr-x  noxlady  staff  160 B    Tue Sep  4 13:34:39 2018  M?    all/
 r-xr-xr-x noxlady staff 192 B Tue Sep 4 13:40:49 2018 ✓  default/