Skip to content

Instantly share code, notes, and snippets.

View langelhc's full-sized avatar

Angel Hañari langelhc

  • Freelancer
  • Peru
View GitHub Profile
@langelhc
langelhc / README.md
Created October 31, 2015 13:35 — forked from magnetikonline/README.md
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@langelhc
langelhc / test
Created November 23, 2016 15:50
react
// client/generateForm/test.jsx
import React, { PropTypes } from 'react';
import $ from 'jquery';
import { Tree, Tooltip } from 'antd';
const TreeNode = Tree.TreeNode;
const x = 3;
const y = 2;
+Scenario: Build the default display for the basic page content type
+ Given I am an anonymous user
+ And I am viewing an "Program affiliation" term with the name "Test Program Term"
+ And I am viewing an "Story series" term with the name "Test Story Series Term"
+ And I am viewing an "Topics" term with the name "Test Topics Term"
+ And I am viewing a "page" content:
+ | title | Test Page |
+ | body | Test body text. |
+ | field_program_affiliation | Test Program Term |
+ | field_topics | Test Topics Term |
@langelhc
langelhc / gist:3ee5922bcb3fe70c94e315ccbb5b4dab
Created May 9, 2018 17:32 — forked from crittermike/gist:618e57a41286e555dea8
A list of Whens, Thens, and Givens for Drupal Behat testing
Given /^(?:|I )am on "(?P<page>[^"]+)"$/
Given /^(?:|I )am on (?:|the )homepage$/
Given :type content:
Given :vocabulary terms:
Given I am an anonymous user
Given I am at :path
Given I am logged in as :name
Given I am logged in as a user with the :permissions permission(s)
Given I am logged in as a user with the :role role(s)
Given I am logged in as a user with the :role role(s) and I have the following fields:
@langelhc
langelhc / drupal.views.html.twig
Created April 24, 2020 17:31
Drupal render facet block inside views twig file
{% set facet_config = {
'show_title': false,
'exclude_empty_facets': false,
'facets_to_include': {
'facet_block:myfacet' : 'facet_block:myfacet'
}
}
%}
{{ drupal_block('facets_block', facet_config) }}
@langelhc
langelhc / test.theme
Created April 24, 2020 17:35
Add term name to body class
function THEME_preprocess_html(&$variables) {
if ($variables['node_type'] == 'page') {
$node_id = \Drupal::routeMatch()->getRawParameter('node');
$node = Node::load($node_id);
if ($term = $node->get('field_page_type')->entity) {
$term_name = $term->get('name')->getString();
switch ($term_name) {
case 'My term':
$variables['page_type'] = $term_name;
break;
@langelhc
langelhc / Local Environment with DDEV
Created July 21, 2020 17:56
How to setup local environment using DDEV
# Requirements:
# 1. How to install composer: https://getcomposer.org/
# 2. How to install DDEV: https://ddev.readthedocs.io/en/stable/
$ composer create-project drupal/recommended-project d8maps
$ cd d8maps
$ ddev config
$ ddev start
$ ddev exec drush site-install --account-name=admin --account-pass=admin
$ composer require drupal/geolocation
<?php
namespace Drupal\outline_design_system\Plugin\Preprocess\Block;
/**
* Highlight CTA block preprocess.
*
* @Preprocess(
* id = "outline_design_system.preprocess.block.highlight_cta",
* hook = "block__highlight_cta"