$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');
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>YouTube Video as a DIV Background</title> | |
| <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
| <style id="jsbin-css"> | |
| html { | |
| overflow-y: scroll; |
| #!/usr/bin/env sh | |
| # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| # Version 2, December 2004 | |
| # | |
| # Copyright (C) 2020 glaszig <[email protected]> | |
| # | |
| # Everyone is permitted to copy and distribute verbatim or modified | |
| # copies of this license document, and changing it is allowed as long | |
| # as the name is changed. |
| -- split-string-into-rows.sql | |
| -- Duane Hutchins | |
| -- https://www.github.com/duanehutchins | |
| -- Split a string into a mysql resultset of rows | |
| -- This is designed to work with a comma-separated string (csv, SET, array) | |
| -- To use a delimiter other than a comma: | |
| -- Just change all the occurrences of ',' to the new delimiter | |
| -- (four occurrences in SET_EXTRACT and one occurrence in SET_COUNT) |
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\example_module\Controller\ExampleModuleController. | |
| */ | |
| // THIS FILE BELONGS AT /example_module/src/Controller/ExampleModuleController.php | |
| namespace Drupal\example_module\Controller; |
| get_latest_release() { | |
| curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
| grep '"tag_name":' | # Get tag line | |
| sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
| } | |
| # Usage | |
| # $ get_latest_release "creationix/nvm" | |
| # v0.31.4 |
| <?php | |
| /** | |
| * Implements hook_form_alter(). | |
| */ | |
| function MODULE_form_user_login_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state) { | |
| // Allow login with email. | |
| array_unshift($form['#validate'], 'MODULE_user_login_form_validate'); | |
| // Change the field label. | |
| $form['name']['#title'] = new \Drupal\Core\StringTranslation\TranslatableMarkup('Email or Username'); |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
$ drush vset install_profile standard
$ drush rr
$ drush cc all
$ drush sqlq "DELETE FROM `system` WHERE filename LIKE 'profiles/pantheon/pantheon.profile'"
$ drush sqlq "UPDATE `system` SET status=1 WHERE filename LIKE 'profiles/standard/standard.profile'"| $.ajaxSetup({ | |
| beforeSend: function(xhr, settings) { | |
| function getCookie(name) { | |
| var cookieValue = null; | |
| if (document.cookie && document.cookie != '') { | |
| var cookies = document.cookie.split(';'); | |
| for (var i = 0; i < cookies.length; i++) { | |
| var cookie = jQuery.trim(cookies[i]); | |
| // Does this cookie string begin with the name we want? | |
| if (cookie.substring(0, name.length + 1) == (name + '=')) { |