Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am xlith on github.
  • I am xlith (https://keybase.io/xlith) on keybase.
  • I have a public key ASAz2bHZ4tI3SFAb1lmpw_ZeSZSMjzqWsEKFX0Xm3rqLrwo

To claim this, I am signing this object:

@xlith
xlith / Blocks.md
Created August 30, 2020 17:41 — forked from bdlangton/Blocks.md
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');
\Drupal::entityTypeManager()->getStorage('node')->loadByProperties(['type' => 'content_type', 'status' => 1]);
@xlith
xlith / script.sh
Last active February 20, 2023 08:39
Templete for a new bash script
#!/usr/bin/env bash
: Setup environment
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi