Skip to content

Instantly share code, notes, and snippets.

View mauhg's full-sized avatar

Mauricio Hernandez mauhg

  • Heredia, Costa Rica
View GitHub Profile
@bdlangton
bdlangton / Blocks.md
Last active October 12, 2023 08:40
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@grayside
grayside / A Series of Useful Outrigger Docker Snippets
Last active February 15, 2018 21:12
Outrigger/Docker Shenanigans Outside a Project Configuration
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.
@crittermike
crittermike / gist:4ea98d07bc7f2a688529
Last active March 19, 2016 19:49
Drupal Console alternatives for common Drush commands
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
@renebakx
renebakx / settings.md
Last active January 23, 2018 09:22
No more drush cr for Drupal 8 theme development

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
@jasondmoss
jasondmoss / simpleXmlToArray.php
Last active October 29, 2024 14:28
Convert a SimpleXML object to associative array
<?php
/**
* Convert a SimpleXML object to an associative array
*
* @param object $xmlObject
*
* @return array
* @access public
*/
@DuaelFr
DuaelFr / blocks.inc
Created July 18, 2013 09:39
Show an image field using field_view_field and colorbox
$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',
),
));
@jmolivas
jmolivas / drupal-8-links.md
Last active December 19, 2015 19:09
Drupal 8 links & resources Drupal 8 Updates, Module Development & Upgrade Drupal 8 Desarrollo y Actualizacion de Módulos
<?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.
@niepi
niepi / Symfony2_Console_Cheat_Sheet.md
Created April 6, 2012 10:20
Symfony2 Console Cheat Sheet
@davereid
davereid / custom.admin_menu.inc
Last active September 29, 2015 07:18
Useful D7 custom functions
<?php
/**
* @file
* Administration menu integration for the custom module.
*/
/**
* Implements hook_admin_menu_cache_info().
*/