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 | |
namespace Drupal\Tests\external_entities\Kernel; | |
use Drupal\Core\DependencyInjection\ContainerBuilder; | |
use Drupal\KernelTests\KernelTestBase; | |
use GuzzleHttp\Promise\FulfilledPromise; | |
use GuzzleHttp\Psr7\Response; | |
use Psr\Http\Message\RequestInterface; |
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 | |
// THIS DOESN'T WORK! | |
// SOME WEIRD INTERNAL CACHING IS HAPPENING - whichever is executed second | |
// is faster! | |
function getLoopList() { | |
return range(1, 10); | |
} |
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
#!/usr/bin/env bash | |
# Script for switching a project to use a git clone of a Drupal contrib module. | |
if [ ! -d repos/$1 ]; then | |
# Get the version of the module that the project currently has installed | |
# so we can clone the same version. This ensures that Composer will accept to | |
# install it. | |
VERSION=`php -r "require_once 'vendor/autoload.php'; print \Composer\InstalledVersions::getReference('drupal/$1');"` |
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 | |
namespace Drupal\Tests\list_predefined_options\Kernel; | |
use Drupal\Component\Plugin\Discovery\DiscoveryInterface; | |
use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException; | |
use Drupal\Core\DependencyInjection\ContainerBuilder; | |
use Drupal\Core\DependencyInjection\ServiceModifierInterface; | |
use Drupal\KernelTests\KernelTestBase; | |
use Drupal\list_predefined_options\ListOptionsManager; |
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
/** | |
* Make a POST request to a form. | |
* | |
* @param string $url | |
* @param array $data | |
*/ | |
protected function doPostForm(string $url, array $data = []) { | |
$request = Request::create($url); | |
$response = $this->doRequest($request); | |
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); |
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
public static function check($checking_key, $data) { | |
try { | |
serialize($data); | |
} | |
catch (\Throwable $e) { | |
// The data fucked up. Go into it to see where. | |
ddm("CATCH $checking_key"); | |
if (is_array($data)) { | |
foreach ($data as $key => $val) { | |
static::check($key, $val); |
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
// Fill in the details with your own. | |
// Paste this as the URL of a new Firefox bookmark. | |
// Use the bookmark when on https://secureform.nextbase.co.uk/ | |
javascript: { | |
document.getElementById('signature').value = ''; | |
document.getElementById('name').value = ''; | |
// Doesn't work yet. | |
// document.getElementById('preferredContact').value = '0'; | |
document.getElementById('email').value = ''; | |
document.getElementById('phone').value = ''; |
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
#!/usr/bin/perl -p | |
# show what the hell is happening with line endings | |
s[ (?<! \r ) \n ] | |
[UNIX\n]x; | |
s[ \r\n] | |
[WIN\n]x; |
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
#!/usr/bin/env drush | |
<?php | |
/** | |
* @file | |
* Drush shell script for creating a patch. | |
* Requires the following setup: | |
* - You are on a git feature branch for your issue. | |
* - The branch name is of the format '1234-description-of-feature' where 1234 | |
* is the drupal.org issue number. | |
* - The feature branch is rebased to the major development branch you want to |
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
$selected_sessions = array(); | |
foreach (array_keys($form_state['values']['timeslots']) as $timeslot_id) { | |
foreach (array_keys($form_state['values']['timeslots'][$timeslot_id]['rooms']) as $room_id) { | |
$cell_form_state_value = $form_state['values']['timeslots'][$timeslot_id]['rooms'][$room_id]['session']; | |
if (!empty($cell_form_state_value)) { | |
$selected_sessions[$cell_form_state_value][] = array($timeslot_id, $room_id); | |
} | |
} | |
} |
NewerOlder