Skip to content

Instantly share code, notes, and snippets.

View nickopris's full-sized avatar

Nick Opris nickopris

  • London, UK
View GitHub Profile
// in preprocessing.php
$variables['lead_form'] =
\Drupal::formBuilder()->getForm('Drupal\my_form_module\Form\LeadForm', 'hero_video');
//it passes that extra variable through getForm into an arguments array added on the end of buildForm
public function buildForm(array $form, FormStateInterface $form_state, string $gated_content_context = NULL) {
if($gated_content_context === 'hero_video') {
<?php
// Turn off all error reporting
error_reporting(0);
// Configuration
$user = 'your_login';
$password = 'you_password';
$host = 'imap.gmail.com';
@nickopris
nickopris / cf7-floating-labels-example-form.html
Created January 19, 2023 21:36 — forked from sagive/cf7-floating-labels-example-form.html
Contact Form 7 (CF7) Floating Labels.
<div class="newsletterSignUpFooter">
<div class="form-group">[text* your-name class:form-control class:input-lg] <label for="your-name">First Name</label></div>
<div class="form-group">[text* text-777 class:form-control class:input-lg] <label for="your-name">Last Name</label></div>
<div class="form-group">[email* your-email class:form-control class:input-lg] <label for="your-name">Your Email</label></div>
<div class="">[submit class:btn class:btn-warning class:btn-lg class:w100 "Send"]</div>
</div>
@nickopris
nickopris / shoutcast.php
Created April 7, 2022 11:58 — forked from njh/shoutcast.php
PHP script to check the status of a Shoutcast stream
<?php
$PLAYLIST_URL = 'http://www.bbc.co.uk/radio/listen/live/r1.pls';
set_time_limit(5);
// Fetch and parse a .pls playlist file
// @returns an array of URLs in the playlist
function readPlaylist($url)