$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);
$block_manager = \Drupal::service('plugin.manager.block');
#!/usr/bin/env bash | |
#styles | |
VP_NONE='\033[00m' | |
VP_RED='\033[01;31m' | |
VP_GREEN='\033[01;32m' | |
VP_YELLOW='\033[01;33m' | |
VP_PURPLE='\033[01;35m' | |
VP_CYAN='\033[01;36m' | |
VP_WHITE='\033[01;37m' |
#!/bin/bash | |
# remove exited containers: | |
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v | |
# remove unused containers: | |
yes | docker container prune | |
# remove unused images: | |
yes | docker image prune | |
# remove unused volumes: | |
yes | docker volume prune |
<?php | |
// Autoload Url and Link classes. | |
use Drupal\Core\Url; | |
use Drupal\Core\Link; | |
/** | |
* External link | |
*/ | |
$url = Url::fromUri('https://colorfield.be'); | |
$link = Link::fromTextAndUrl(t('Colorfield'), $url); | |
$link = $link->toRenderable(); |
<?php | |
/* | |
* Change type for existing Field. Drupal. | |
*/ | |
$field = 'field_example'; | |
db_change_field('field_data_' . $field, $field . '_value', $field . '_value', array( | |
'type' => 'numeric', | |
'precision' => 10, |