Skip to content

Instantly share code, notes, and snippets.

View johndevman's full-sized avatar

John Svensson johndevman

View GitHub Profile
@johndevman
johndevman / ConfigImporterFactory.php
Created March 31, 2020 12:53
Config importer factory
<?php
class ConfigImporterFactory {
/**
* The event dispatcher used to notify subscribers.
*
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface
*/
protected $eventDispatcher;
@johndevman
johndevman / swedish_phone_number_area_codes.php
Created February 13, 2020 13:04
Swedish phone number area codes
<?php
$areaCodes = [
'011' => 1,
'0120' => 1,
'0121' => 1,
'0122' => 1,
'0123' => 1,
'0125' => 1,
'013' => 1,
@johndevman
johndevman / sv.po
Created October 23, 2019 08:47
Drupal 8 User interface translation file
msgid ""
msgstr ""
"Project-Id-Version: Drupal 8\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\\n"
msgid "@type %title has been created."
msgstr "@type %title har skapats."
@johndevman
johndevman / FullNameBlock.php
Last active July 6, 2018 13:40
An example context aware block that combines two fields to be used in Layout Builder
<?php
namespace Drupal\example\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Component\Render\FormattableMarkup;
/**
* Provides the full name of the author of the given node from context.
*
@johndevman
johndevman / LayoutDefaultConfig.php
Last active June 19, 2018 13:07
Configurable layout plugin
<?php
namespace Drupal\example\Plugin\Layout;
use Drupal\Core\Layout\LayoutDefault;
use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a default class for configurable Layout plugins.
@johndevman
johndevman / _grid.scss
Last active April 4, 2017 12:07
BEM Sass grid component
$grid-columns: 12 !default;
$grid-gutter: 10px !default;
$grid-gutter-half: $grid-gutter / 2;
.grid {
/*@include breakpoint("tablet") {
flex-direction: row;
}*/
display: flex;
flex-direction: column;