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\tablefield\Functional; | |
use Drupal\Tests\BrowserTestBase; | |
/** | |
* Simple test to ensure that a field can be created. | |
* | |
* @group tablefield |
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
/** | |
* {@inheritdoc} | |
*/ | |
public function viewElements(FieldItemListInterface $items, $langcode) { | |
$elements = []; | |
$id = $items->getEntity()->id(); | |
# Generate a wrapper to use as dom root to attach the React component. | |
$field_name = $this->fieldDefinition->getItemDefinition()->getFieldDefinition()->getName(); | |
$wrapper_id = 'drupal-and-react-app-' . $field_name .'-'. $id; |
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 | |
/** | |
* Implements hook_preprocess_views_view | |
*/ | |
function my_module_preprocess_views_view(&$vars){ | |
// Only use unique IDs for view. | |
// Use this code for views with Better Exposed Filters. | |
if ($vars['view']->id() === 'view_name_bef') { | |
$rows = []; |
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
/* | |
Start Bootstrap style responsive spacer helper | |
Utilities for spacing, text and float | |
*/ | |
$spacer: 1rem !default; | |
$spacers: () !default; | |
$spacers: map-merge(( |
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 | |
/** | |
* Set redis configuration. | |
*/ | |
/** @see: https://docs.platform.sh/frameworks/drupal8/redis.html */ | |
if (extension_loaded('redis')) { | |
// Set Redis as the default backend for any cache bin not otherwise specified. | |
// $settings['cache']['default'] = 'cache.backend.redis'; |
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\my_module\Plugin\views\style; | |
use Drupal\rest\Plugin\views\style\Serializer; | |
/** | |
* The style plugin for serialized output formats. | |
* | |
* @ingroup views_style_plugins |
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\my_module\Plugin\views\style; | |
use Drupal\Core\Annotation\Translation; | |
use Drupal\rest\Plugin\views\style\Serializer; | |
use Drupal\views\Annotation\ViewsStyle; | |
/** | |
* Class ViewsSerializerCount |
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
use Drupal\Core\Url; | |
use Symfony\Component\HttpFoundation\Request; | |
function my_function() { | |
$previousUrl = \Drupal::request()->server->get('HTTP_REFERER'); | |
$fake_request = Request::create($previousUrl); | |
$url_object = \Drupal::service('path.validator')->getUrlIfValid($fake_request->getRequestUri()); | |
if ($url_object) { | |
$route_name = $url_object->getRouteName(); | |
// Do something with $route_name; |
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
// Vanilla version of FitVids | |
// Still licencened under WTFPL | |
// | |
// Not as robust and fault tolerant as the jQuery version. | |
// And also, I don't support this at all whatsoever. | |
const vanillaFitVids = () => { | |
// List of Video Vendors embeds you want to support | |
const players = [ | |
'iframe[src*="youtube.com"]', |