$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');
| cd repository | |
| git checkout --orphan orphan_name | |
| git rm -rf . | |
| rm '.gitignore' | |
| echo "#Title of Readme" > README.md | |
| git add README.md | |
| git commit -a -m "Initial Commit" | |
| git push origin orphan_name |
| [ | |
| /**! | |
| wrp | |
| Quick way to grap a web_request param | |
| 2017-05-02 JC Added examples | |
| 2014-10-08 JC Added to Gist | |
| 2014-10-08 JC Added separate methods for queryparams and postparams | |
| 2014-08-24 JC Rewrite of the wrp method once again. This time with code suggested by Brad Lindsay in a lassotalk thread. Introduces the param -all |
| [ | |
| /**! | |
| valid_date | |
| Replacement of valid_date that adds an optional param -strict. When set to true it will fail on dates that doesn't exist in the real world. Like 2010-02-31. | |
| When used with strict assumes that date inputs are either as ISO or US date format. | |
| 2014-10-13 JC Added to Gist |
| ; generates interdiff into ~/patches from current diff | |
| alias.interdiff=!git diff > ~/patches/interdiff.txt | |
| ; generates interdiff into ~/patches from current staged diff | |
| alias.interdiff-stg=!git diff --staged > ~/patches/interdiff.txt | |
| ; generates patch into ~/patches based on branch name. | |
| ; usage git genpatch {comment number} | |
| alias.genpatch=!sh -c "br=`git symbolic-ref HEAD|sed s#refs/heads/##`; git diff origin/8.0.x > ~/patches/\${br}.$1.patch" | |
| ; rebase branch of 8.0.x | |
| alias.rebase8x=!git fetch origin && git rebase origin/8.0.x | |
| ; merge 8.0.x |
| #!/bin/bash | |
| # Usage | |
| # $ ./install-cert-macos.sh "/path/to/cert" | |
| CERT_PATH="$1" | |
| # First, grab the SHA-1 from the provided SSL cert. | |
| CERT_SHA1=$(openssl x509 -in "$CERT_PATH" -sha1 -noout -fingerprint | cut -d "=" -f2 | sed "s/://g") | |
| # Next, grab the SHA-1s of any standard.dev certs in the keychain. | |
| # Don't return an error code if nothing is found. |
| <?php | |
| namespace Drupal\video_embed_field\Plugin\Field\FieldFormatter; | |
| use Drupal\Core\Cache\CacheableMetadata; | |
| use Drupal\Core\Entity\EntityStorageInterface; | |
| use Drupal\Core\Field\FieldDefinitionInterface; | |
| use Drupal\Core\Field\FormatterBase; | |
| use Drupal\Core\Field\FieldItemListInterface; | |
| use Drupal\Core\Form\FormStateInterface; |
| <?php | |
| /** @var \Drupal\node\Entity\Node[] $landing_pages */ | |
| $landing_pages = \Drupal::entityTypeManager() | |
| ->getStorage('node') | |
| ->loadByProperties([ | |
| 'type' => 'landing_page' | |
| ]); | |
| $old_paragraph_fields = [ | |
| 'field_tile_section', |
| /* You'll need the following packages: stylelint, stylelint-config-standard, stylelint-order */ | |
| { | |
| "extends": "stylelint-config-standard", | |
| "plugins": [ | |
| "stylelint-order" | |
| ], | |
| "rules": { | |
| "length-zero-no-unit": [true, {"ignore": ["custom-properties"]}], | |
| "property-no-vendor-prefix": null, |