This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types = 1); | |
use Drupal\DrupalExtension\Context\RawDrupalContext; | |
/** | |
* Defines step definitions that are generally useful for the project. | |
*/ | |
class FeatureContext extends RawDrupalContext { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prerequisites | |
# place this script in a directory called tools to sit at he same level as your project directory | |
# an .env file with credentials inside tools | |
# get the solr archive from prod or me. should be extracted into tools with the name solr_8.x_config | |
# Be aware that git pull and docker image pull are subjected to quota limits and may need to authenticate. | |
# script vars | |
PROJECT_DIRECTORY="your-project-new-folder" | |
MY_FORKED_REPO='https://github.com/...' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Turn off all error reporting | |
error_reporting(0); | |
// Configuration | |
$user = 'your_login'; | |
$password = 'you_password'; | |
$host = 'imap.gmail.com'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file Contains \Drupal\custom_module\Plugin\Field\FieldType\RoleRate | |
*/ | |
namespace Drupal\custom_module\Plugin\Field\FieldType; | |
use Drupal\Core\Field\FieldStorageDefinitionInterface; | |
use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem; | |
use Drupal\Core\Form\FormStateInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dates = [ | |
"12/01/2021", | |
"12/05/2021", | |
"12/09/2021", | |
"12/10/2021", | |
"12/11/2021", | |
"12/15/2021", | |
"12/10/2021", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param $postcode | |
* | |
* @return array | |
*/ | |
function getGeoLocationFromPostcode($postcode) { | |
$geo = []; | |
$url = "https://api.postcodes.io/postcodes/" . $postcode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* https://www.movable-type.co.uk/scripts/latlong.html | |
* @param $lat1 | |
* @param $lat2 | |
* @param $lon1 | |
* @param $lon2 | |
* | |
* @return float|int |
NewerOlder