Skip to content

Instantly share code, notes, and snippets.

@balsama
balsama / drupal-project-docroot-convert.sh
Created December 5, 2018 15:26
Convert the web-served directory name in drupal-composer/drupal-project
#!/usr/bin/env bash
# DESCRIPTION:
# https://github.com/drupal-composer/drupal-project assumes your web-served
# directory is named `web`. But certain hosts (e.g. Acquia) need this directory
# to be named `docroot`. This script will convert the name of the directory to
# `docroot` or any other arbitrary name passed as an argument.
#
# USAGE:
# 1. Copy this file into the repo root of a project created with
@balsama
balsama / composer.json
Created October 3, 2018 19:42
Headless with new patch
{
"name": "acquia/headless_lightning",
"description": "Drupal Lightning as a backend for fully decoupled applications.",
"type": "drupal-profile",
"license": "GPL-2.0-or-later",
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"drupal/devel": "^1.0",
"drupal/console": "^1.0.0",
@balsama
balsama / lightning-user-stories-layout.md
Last active March 12, 2018 17:48
Lightning Layout User Stories

Layout

  1. When I create a one-off page I want to be able to add blocks and position them for just that page so both the layout and the content are unique.

    Solution: Allow overrides enabled and editor modifies via IPE

  2. When I edit a content type, I want to set a default layout that suits the fields in that type so my content type layouts vary in a way that makes them quickly identifiable.

    Solution: Create a layout via Panelizer wizard.

  3. When I create content I want to be able to choose a layout for just one post, so I can use layout to visually emphasize something unique about the content.

> Solution: Create multiple layouts via Panelizer wizard and select more than one as available to Editors.

@balsama
balsama / behat.partial.yml
Last active February 12, 2018 17:39
Example partial configuration file to be used with Lightning's configure:behat command.
default:
suites:
default:
paths:
- '%paths.base%/features'
@balsama
balsama / lightning-user-stories-workflow.md
Created January 11, 2018 15:14
Lightning Workflow User Stories

Workflow

  1. When I build a site I want to be able to create any number or type of workflow states so that the workflow process conforms to the real needs of the organization not a rigid pre-defined scheme.
  2. When I create or edit content I want to flag it as needs review, needs translation etc. or save it as published, not published, etc. so that anyone involved knows what to do with it next.
  3. When I edit content I want to visually compare revisions so I can easily make decisions about which version to use - for example, while reverting to an earlier version.
  4. When I edit content I want to track revisions, and their meta-data, so if in the future I’m asked to produce records for compliance, I can easily do that.
  5. When I edit content I want to schedule a group of articles to be published on a future date so I won’t have to publish each one individually and I can preview them together.
@balsama
balsama / lightning_sub_profile.info.yml
Last active November 13, 2018 15:32
Sample Lightning sub-profile info file.
name: 'Lightning sub-profile'
type: profile
version: 8.x-dev
description: 'Sub-profile of Lightning'
core: '8.x'
themes:
- bartik
- seven
@balsama
balsama / composer-enable-asset-packagist.sh
Created September 20, 2017 13:29
Update your root composer.json file to support Asset Packagist
#!/usr/bin/env bash
# Place this script in your project root and invoke it with "bash scriptname"
# Alternatively, you can just switch into the directory that contains Lightning
# and run "composer run enable-asset-packagist".
cd ./docroot/profiles/contrib/lightning; # Your path to Lightning might differ.
composer run enable-asset-packagist;
@balsama
balsama / lightningInteractions.php
Last active June 15, 2017 20:00
Processor to format raw table data into format suitable for google sheets charts.
<?php
/**
* Formats data generated by Sumo into a Google Sheets charts-friendly format.
*
* Add to or change the data in the data array at the bottom (formatted as such
* so that you can just copy/paste data out of a table). The constructor will
* process and format all of the data for you. Then you can spit it out using
* the process() method.
*/

Lightning URL Patterns

Summary

  • \/admin\/panels_ipe\/variant\/panelizer_default\/\*node:\d:.*:.*
  • \/admin\/structure\/(panelizer\/edit|panels\/panelizer\.wizard).*
  • \/entity-browser\/(modal|iframe)\/(image_browser|media_browser).*
  • \/media\/add.*
  • \/admin\/structure\/workbench-moderation\/.*
  • \/admin\/content\/(scheduled-update|scheduled_update).*
@balsama
balsama / subprofile.feature
Last active May 4, 2017 15:53
Tests for Lightning Project SUBPROFILE env.
@api @subprofile
Feature: Subprofiles
Scenario: Sub-profile name should be listed and installed profile
Given I am logged in as a user with the administrator role
When I visit "/admin/reports/status"
Then I should see "Lightning Extender"
Scenario: Base profile extensions that are excluded by the sub-profile should not be enabled
Given I am logged in as a user with the administrator role