$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');
#progresswrapper { | |
position: fixed; | |
top: 0px; | |
height: 2px; | |
width: 100%; | |
z-index: 1000; | |
} | |
#progressbar { | |
top: 0; | |
position: fixed; |
<!doctype html> | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> | |
<script> | |
$(document).ready(function(){ | |
var getMax = function(){ |
<?php | |
/** | |
* Implements hook_entity_form_display_alter(). | |
*/ | |
function MY_MODULE_entity_form_display_alter(&$form_display, array $context) { | |
if ($context['entity_type'] == 'node' && $context['bundle'] == 'MY_BUNDLE') { | |
$current_user = \Drupal::currentUser(); | |
if ($current_user->hasPermission('CUSTOM PERMISSION')) { | |
$storage = \Drupal::entityManager()->getStorage('entity_form_display'); |
<?php | |
namespace Drupal\ppdx_editor\Plugin\Filter; | |
use Drupal\Component\Utility\Html; | |
use Drupal\Core\Entity\EntityRepositoryInterface; | |
use Drupal\Core\Image\ImageFactory; | |
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
use Drupal\file\FileInterface; | |
use Drupal\filter\FilterProcessResult; |
<?php | |
// Import arbitrary config from a variable. | |
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html'); | |
$config->setData($data)->save(); | |
// Or, re-import the default config for a module or profile, etc. | |
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module'); | |
// Or, import YAML config an arbitrary directory. |
#!/bin/bash | |
function greenecho { | |
echo "" && echo -e "\e[30;48;5;82m ✔ $1 \e[0m" | |
} | |
function orangeecho { | |
echo "" && echo -e "\e[30;48;5;208m ⚠ $1 \e[0m" | |
} | |
# Get document root path |
<?php | |
namespace Drupal\opitools\Commands; | |
use Drush\Commands\DrushCommands; | |
use Drupal\Core\Language\LanguageInterface; | |
/** | |
* A Drush commandfile. | |
* |