$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');
The individual files in this gist each have a unique trick to offer. They may be moved to official documentation or individual gists at a future date. | |
This file is mostly added because gists insist on titling the page with the alphabetically first file name, instead of the gist title. |
Clear caches | |
- Drush: drush cc all | |
- Console: drupal cache:rebuild (cr) all | |
Install a module | |
- Drush: drush en modulename | |
- Console: drupal module:install modulename | |
Uninstall a module | |
- Drush: drush dis modulename |
this bit goes in development.services.yml
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory
parameters:
twig.config:
debug: true
auto_reload: null
cache: false
<?php | |
/** | |
* Convert a SimpleXML object to an associative array | |
* | |
* @param object $xmlObject | |
* | |
* @return array | |
* @access public | |
*/ |
$build = field_view_field('user', $context['entity'], 'field_picture', array( | |
'label' => 'hidden', | |
'type' => 'colorbox', | |
'settings' => array( | |
'colorbox_node_style' => 'user_large', | |
'colorbox_image_style' => 'colorbox', | |
), | |
)); |
Resources moved to a git repository in order to make easy fork & contribution
https://github.com/jmolivas/drupal8-links
Feel free to fork & contribute :)
<?php | |
/** | |
* @file | |
* Default theme implementation to display the basic html structure of a single | |
* Drupal page. | |
* | |
* Variables: | |
* - $css: An array of CSS files for the current page. | |
* - $language: (object) The language the site is being displayed in. |
idea and initial content from http://jamandcheese-on-phptoast.com/2011/12/18/symfony2-console-cheat-sheet/
Structure
php app/console generate:bundle --namespace=[namespace]/[bundle name]Bundle --format=[bundle configuration format]