Skip to content

Instantly share code, notes, and snippets.

@dinarcon
dinarcon / nicaragua.module
Created November 7, 2017 14:20
Conditional fields in Paragraphs using the Javascript States API for Drupal 8
/**
* @file
* Example code from http://agaric.com/blogs/conditional-fields-paragraphs-using-javascript-states-api-drupal-8.
*/
/**
* Implements hook_field_widget_WIDGET_TYPE_form_alter().
*
* Example of conditional fields in paragraphs for Drupal 8.
*/
@dinarcon
dinarcon / mbe_book_paragraph.csv
Created August 15, 2017 02:22
Drupal 8 migrations by example
Professor ID Title Author
P01 The pushcart war Jean Merrill
P02 The definite guide to Drupal 7 Benjamin Melançon et al.
P03 The five love languages Gary Chapman
@dinarcon
dinarcon / migrate_plus.migration.omdb_json.yml
Last active July 3, 2022 11:03
Drupal 8 JSON Migration Example
# This is the *third* configuration to import with configuration type: 'Migration'
# This migration demonstrates importing from a monolithic JSON file.
# Forked from https://github.com/heddn/json_example_migrate/blob/json/web/modules/custom/custom_migrate/config/install/migrate_plus.migration.omdb_json.yml
uuid: b113ad9f-1ed7-43e5-802c-0e0270d2b7fa
id: omdb_json_article
label: JSON feed of movies (Article)
migration_group: json_example
source:
# We use the JSON source plugin.
plugin: url
@dinarcon
dinarcon / behat-test.feature
Created September 7, 2019 21:03
WordPress BDD testing with Behat and WordHat
Feature: Visibility of the homepage
In order to have confidence that my site is accessible
As a site administrator
I want to verify I can visit the homepage
Scenario: Verify the homepage
Given I am on the homepage
Then the response status code should be 200
@dinarcon
dinarcon / pantheon_drupal_migration.sh
Created October 27, 2021 22:16
Run Drupal migrations on Pantheon
#!/bin/bash
# Script to run Drupal migrations on Pantheon.
# See also https://pantheon.io/blog/running-drupal-8-data-migrations-pantheon-through-drush
# Make sure the command is called with at least 3 arguments. Example:
# ./pantheon_drupal_migration.sh target_environment.multidev source_environment.multidev upgrade_d7_user upgrade_d7_file
[ $# -lt 3 ] && { echo "Usage: $0 [d9_target_site_id.env] [d6_source_site_id.env] [migration_ids]" ; exit 1; }
TARGET=$1
@dinarcon
dinarcon / FeatureContext.php
Created April 11, 2019 20:15
Drupal 8 BDD with Behat
<?php
use Behat\Mink\Exception\ExpectationException;
use Behat\MinkExtension\Context\RawMinkContext;
// Located at ./features/bootstrap/
/**
* FeatureContext class defines custom step definitions for Behat.
*/
@dinarcon
dinarcon / quick-start.md
Created July 11, 2020 20:48
Install Drupal with the quick-start command
source:
defaults:
MY_VALUE: 'http://understanddrupal.com'
plugin: source_plugin_name
source_plugin_config: source_config_value
process:
process_destination: defaults/MY_VALUE
.
|-- core
|-- index.php
|-- modules
| `-- custom
| `-- ud_migrations
| `-- ud_migrations_first
| |-- migrations
| | `-- udm_first.yml
| `-- ud_migrations_first.info.yml
uuid: b744190e-3a48-45c7-97a4-093099ba0547
id: udm_config_json_source_node_local
label: 'UD migrations configuration example'
dependencies:
enforced:
module:
- ud_migrations_config_json_source