Skip to content

Instantly share code, notes, and snippets.

View pthurmond's full-sized avatar

Patrick Thurmond pthurmond

View GitHub Profile

Drupal Permissions Setup

I am writing this in conjunction with the setup of a new Drupal 10 site on my local. The setup is a little different than the instructions call for because I am doing the setup within Lando. This means that the permissions didn't come out right and editing the site files directly on my machine leads to having read-only access.

Work done here is on Mac OS X 13.5 Ventura. But should apply to any Mac or Linux machine.

To resolve that, I did the following things after the initial site setup with composer within Lando:

  1. First, I checked the directory permissions. You can do that with stat -f '%A %N' *.
  2. That shows me the permissions in numerical format. All the files should be 644 and the directories be 755.
pthurmond / .gitignore
Last active July 26, 2022 20:44
Example of a Drupal 8 composer file with patches
# Ignore directories generated by Composer
pthurmond /
Last active January 7, 2022 21:05
Pause YouTube videos on slide change. Example with SwiperJS and Drupal 9.


This requires one more thing. The YouTube video URL needs parameters to tell it to accept commands. In my application, which is Drupal 9, I use a hook to modify the URL of all YouTube video URLs.

Example URL:

Specifically, the "enablejsapi" parameter is what enables this. I will also share a php file with the Drupal hook I used for this.

To learn more about the optional parameters you can pass, look at this documentation:

pthurmond / associative_array_splicer.php
Last active April 17, 2021 04:10
This is a tool to allow a programmer to easily insert a new associative index into a desired position in a PHP associative array.
* Insert an associative array into a specific position in an array.
* @param array $original
* The original array to add to.
* @param array $new
* The new array of values to insert into the original.
* @param int $offset
* The position in the array ( 0 index ) where the new array should go.