Skip to content

Instantly share code, notes, and snippets.

View althafhpa's full-sized avatar

Althaf althafhpa

  • Sydney
  • 08:18 (UTC +10:00)
View GitHub Profile
Paragraph used for creating reusable content components in Drupal.
You can also create nested paragraphs using other paragraphs.
You can then create a layout for paragraphs for example displaying content in 2 columns in multiple ways
- Through manage display section of drupal paragraph configuration which can use a css grid like bootstrap.
- Using paragraph grid module but within the editor level which can use css grid like bootstrap and material grid.
- Hardcoding the particular paragraph twig file separate fields. Will require some coding. For example to display content into 2 columns you will need to loop through fields and display into 2 columns.
@althafhpa
althafhpa / gist:80d428a57eefd56429ccf66fee19ac44
Created April 13, 2025 07:37
Helper function to verify file exists on Drupal website
/**
* Helper function to verify file exists on Drupal website.
*
* @param string $path
* The file path.
* @param array $options
* Options for the HTTP request.
*
* @return array
* An array with 'exists' (boolean) and 'status_code' (int).
document.addEventListener('DOMContentLoaded', () => {
async function initializeNavigation() {
const response = await fetch('https://gist.githubusercontent.com/althafhpa/ad0d70bb29aac142b7785e27b5d931e7/raw/a4589c9ee74e54683216b468f38463c2454ca29c/test-nav.json');
const NAV_DATA = await response.json();
// Sound system initialization
const clickSound = new Audio('/sounds/click.mp3');
const openSound = new Audio('/sounds/open.mp3');
const closeSound = new Audio('/sounds/close.mp3');
const hoverSound = new Audio('/sounds/hover.mp3');
[
{
"category": "Visual Regression",
"description": "Automation",
"items": [
{
"name": "Visual Difference",
"description": "oEmbed Visual Comparison between Drupal and Optimizely",
"link": "/visual-diff/index.html",
"icon": "",
custom_permissions.info.yml
name: 'Custom Permissions'
type: module
description: 'Overrides access permissions for a contrib module.'
core_version_requirement: ^8 || ^9
package: Custom
dependencies:
- drupal:module_name
@althafhpa
althafhpa / 4096_acquia.inc
Created March 30, 2024 19:53 — forked from aaron-wagner/4096_acquia.inc
Acquia.inc file for whitelisting IP addresses
<?php
/**
* @file
* Utilities for use in protecting an environment via basic auth or IP whitelist.
* Modified for use with Drupal 8
*/
function ac_protect_this_site($conf) {
//global $conf;
//$client_ip = ip_address();
@althafhpa
althafhpa / gist:fec9dd57e49627b680b7fe238672e93b
Last active March 19, 2024 02:56
Content Embed Option: IFRAME Vs oEmbed
Embed Option: IFRAME Vs oEmbed
IFRAME:
1. Depending on the browser (in this case, Chrome), you cannot use an iframe embed that points to an http source within Samepage. Since Samepage runs on https (to encrypt traffic between the server and the browser for users' privacy), Chrome requires anything that is embedded in the page to also be https.“Refused to display…'X-Frame-Options’ to ‘SAMEORIGIN’”. Will have to Set up a whitelist of domains that can render in an iframe.
2. User Experience may not be consistent.
3. There may be issues with different browsers and devices with rendering and security policy.
oEmbed: