Skip to content

Instantly share code, notes, and snippets.

@ultimike
ultimike / UpdateRepositoryForm.php
Created April 4, 2024 16:59
UpdateRepositoriesForm with dependency injection
<?php
declare(strict_types=1);
namespace Drupal\drupaleasy_repositories\Form;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\drupaleasy_repositories\DrupaleasyRepositoriesBatch;
@ultimike
ultimike / launch.json
Created October 28, 2023 14:59
Visual Studio Code debug configuration
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"log": false,
@ultimike
ultimike / settings.json
Created October 28, 2023 14:42
Visual Studio Code workspace settings
{
/* DDEV container */
/* PHP Linting */
"php.validate.executablePath": "/usr/bin/php",
/* PHP Sniffer & Beautifier */
"phpsab.executablePathCS": "/var/www/html/vendor/bin/phpcs",
"phpsab.executablePathCBF": "/var/www/html/vendor/bin/phpcbf",
"phpsab.standard": "/var/www/html/phpcs.xml",
"phpsab.snifferEnable": true,
"phpsab.fixerEnable": true,
@ultimike
ultimike / settings.json
Last active March 3, 2024 19:41
Visual Studio Code user settings
{
"breadcrumbs.enabled": true,
"css.validate": true,
"diffEditor.ignoreTrimWhitespace": false,
"editor.tabSize": 2,
"editor.autoIndent": "full",
"editor.insertSpaces": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": false,
"editor.renderWhitespace": "boundary",
<?php
namespace Drupal\drupaleasy_repositories;
use Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher;
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
~/sites/de8 💎 ddev debug test
Running bash [-c /var/folders/14/smxxhc1j1r5_plmdk13slbt00000gn/T/test_ddev.sh]
======= Existing project config =========
These config files were loaded for project de8: [/Users/michael/sites/de8/.ddev/config.yaml]
name: de8
type: drupal9
docroot: web
php_version: 8.2
webserver_type: nginx-fpm
webimage: drud/ddev-webserver:v1.21.4
@ultimike
ultimike / menu.css
Last active October 16, 2022 16:48
CSS solution to DCO Starterkit theme menu layout homework.
.dco-menus {
display: flex;
flex-direction: column;
gap: 0.5em;
}
.dco-menus .region-primary-menu {
order: 1;
}
<?php
public function go() {
// Documentation: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21Query%21QueryInterface.php/interface/QueryInterface/8.9.x
// Example 1
$query = \Drupal::entityQuery('node')
->condition('type', 'blog')
->condition('field_blog_type', '0') // 0=Tutorial, 1=News item
->range(0, 10)
/* Setting up codebase */
mkdir d7d8mod
cd d7d8mod
ddev config
ddev start
ddev composer create drupal/recommended-project
cp web/sites/default/default.settings.php web/sites/default/settings.php
ddev config
ddev restart
ddev . drush site-install --account-pass=admin

Keybase proof

I hereby claim:

  • I am ultimike on github.
  • I am ultimike (https://keybase.io/ultimike) on keybase.
  • I have a public key ASA2b-FtiikX545ltL_Iipf_iSF6Hw_eew0NJc56PRGTRgo

To claim this, I am signing this object: