Skip to content

Instantly share code, notes, and snippets.

View jasonawant's full-sized avatar

Jason Want jasonawant

  • Red Hat
  • New Orleans, LA
View GitHub Profile
@jasonawant
jasonawant / cloudSettings
Created August 22, 2022 13:49 — forked from merauluka/cloudSettings
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-04-22T06:14:30.148Z","extensionVersion":"v3.4.3"}
@jasonawant
jasonawant / my_module.install.php
Created February 20, 2018 04:27
A Drupal 8 update hook to uninstall workbench moderation
<?php
/**
* Uninstall workbench_moderation module and its fields, update content overview page.
*/
function my_module_update_8001() {
if (\Drupal::service('module_handler')->moduleExists('workbench_moderation')) {
// Delete moderation_state fields.
// @see \Drupal\workbench_moderation\Form\PrepareUninstallForm::submitForm().
// @see https://www.drupal.org/node/2627012
<?php
namespace Drupal\project_core\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Component\Utility\Html;
use \Drupal\node\Entity\Node;
function relater_node_presave(EntityInterface $node) {
if ($node->bundle() == 'my_custom_node') {
$embeds = _relater_get_embeds($node);
$node->field_my_entityref->setValue($embeds);