Skip to content

Instantly share code, notes, and snippets.

@mparker17
mparker17 / Bug report template.jira
Created September 29, 2021 19:30
How to write a basic website bug report
h2. Description
(describe the bug)
h2. URL
(is there an example URL where the bug is immediately visible?)
h2. Role
@mparker17
mparker17 / mannequin-setup.sh
Last active May 11, 2019 20:27
Trying out Mannequin with Lando and Drupal 8.6.
#!/bin/bash
# Variables.
export PROJECT_NAME="mannequin"
export DOCROOT_DIR="web"
export THEME_NAME="my_theme"
# Set up a directory for the project.
mkdir "$PROJECT_NAME"
cd "$PROJECT_NAME" || exit 1
@mparker17
mparker17 / update-pressflow-6.sh
Last active March 20, 2019 17:58
Updating Pressflow/Drops
#!/bin/bash
#
# @file
# Update pressflow/6.
#
# Some variables to start off with.
export my_fork_clone_url='https://github.com/mparker17/6'
export patch_id='SA-CORE-2019-002'
# The actual script.
@mparker17
mparker17 / ajax_callback.md
Created August 17, 2018 20:24
Drupal 8 Form API #ajax.callback

'#ajax' => ['callback' is weird.

Looking at examples from Drupal core, there seems to be a bunch of different ways you can call it...

  • 'callback' => 'some_global_function' is the simplest and always seems to work, but the function it calls has to be defined in a .module file, not a class.

  • 'callback' => [$this, 'someFunction'] works sometimes, but you get a 'cannot serialize database service' error if any of $this' properties (or anything they reference) involves a database connection.

  • 'callback' => [static::class, 'someFunction'] works, but calls someFunction() in a static context, meaning you can't use $this->someService->doSomething().

    This is equivalent to, and has the same problems as:

  • 'callback' => [get_class($this), 'someFunction'],

@mparker17
mparker17 / fix-d8-empty-install-profile.md
Last active July 26, 2023 04:36
Fixing a Drupal 8 site with an empty install profile

Fixing a Drupal 8 site with an empty install profile

You'll probably notice this because of a series of errors like the ones below on the status report at /admin/reports/status:

    Notice: Undefined index: name in system_requirements() (line 59 of core/modules/system/system.install).
    Notice: Undefined index: version in system_requirements() (line 61 of core/modules/system/system.install).

To fix this...

  1. Check settings.php and settings.local.php in the order they are parsed for lines that look like $settings['install_profile']
@mparker17
mparker17 / drupal8-fix-missing-extension-schema-version.sh
Last active January 26, 2018 20:11
Tell Drupal 8 about a .install file for a module that didn't have one before
#!/bin/bash
#
# @file
# Tell Drupal 8 about a .install file for a module that didn't have one before.
#
# Very rarely, a Drupal 8 module might end up without a row in the `key_value`
# table's `system.schema` collection. When this happens, Drupal won't load its
# `.install` file. As of Drupal 8.4, it is only possible to fix this manually.
#
# You can fix this manually with the following drush command, assuming
@mparker17
mparker17 / README.md
Last active August 24, 2018 16:13
Set up a simple markdown renderer in a folder

Install

To set up this project, you will need to:

  1. install rbenv,
  2. use rbenv to install the correct version of the Ruby programming language,
  3. use the Ruby programming language's tools to install Bundler, and finally,
  4. use bundler to install this project's only dependency, Spiffy.

These steps are detailed below...

@mparker17
mparker17 / composer-cgr-setup.sh
Created November 3, 2017 17:26
Composer and CGR
#!/bin/bash
#
# @file
# Set up cgr, then cgr common projects.
#
# Notes:
# - Composer installed via PHAR in $PATH; ln -s composer.phar composer
# - Drush installed via PHAR in $PATH; ln -s drush.phar drush
#
composer global require 'consolidation/cgr'
@mparker17
mparker17 / (Popular Drupal src subdirs).md
Last active March 24, 2023 17:36
Popular Drupal src/ subdirectories
@mparker17
mparker17 / .tidy-config
Last active August 16, 2019 06:58
HTML Tidy (htacg/tidy-html5) configuration file.
//
// @file
// HTML Tidy (htacg/tidy-html5) configuration file.
//
// HTML, XHTML, XML Options.
bare: yes
clean: yes
drop-proprietary-attributes: yes
// Pretty Print Options.