Skip to content

Instantly share code, notes, and snippets.

View nonom's full-sized avatar
🎯
Focusing

Antonio Martínez nonom

🎯
Focusing
View GitHub Profile
<?php
declare(strict_types=1);
namespace Drupal\darwin_co_authors\Plugin\FormAlter;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\pluginformalter\Plugin\FormAlterBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
<?php
/**
* @file
* mymodule module.
*/
use Drupal\Core\File\FileSystemInterface;
/**
<?php
namespace Drupal\boost\EventSubscriber;
use Drupal\boost\BoostCacheInterface;
use Drupal\Component\Plugin\Factory\FactoryInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\ImmutableConfig;
use Drupal\Core\Render\HtmlResponse;
use Drupal\Core\Render\AttachmentsResponseProcessorInterface;
<?php
use Drupal\Core\Entity\EntityInterface;
use Drupal\file\Entity\File;
use Drupal\node\Entity\Node;
/**
* Implements hook_entity_presave().
* @param \Drupal\Core\Entity\EntityInterface $entity
*/
@nonom
nonom / ImageRenderExampleBlock.php
Created October 12, 2022 13:32 — forked from pixelmord/ImageRenderExampleBlock.php
[Drupal 8] Create file/ media_entity programmatically
<?php
/**
* @file
* Contains Drupal\mymodule\Plugin\Block\ImageRenderExampleBlock.
*/
namespace Drupal\mymodule\Plugin\Block;
use Drupal\Core\Block\BlockBase;
<?php
// src/Controller/CustomHooksDemoController.php
namespace Drupal\custom_hooks_demo\Controller;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ModuleHandler;
use Psr\Log\LoggerInterface;
@nonom
nonom / hook_install_tasks_alter.patch
Created July 29, 2022 16:01
Avoid to download translations with the minimal profile on install-clean.
diff --git a/core/profiles/minimal/minimal.module b/core/profiles/minimal/minimal.module
new file mode 100644
index 0000000000..f5abe1de5e
--- /dev/null
+++ b/core/profiles/minimal/minimal.module
@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * @file
<?php
declare(strict_types = 1);
namespace Drupal\upd_list_pages_autocomplete\Plugin\facets\widget;
use Drupal\Core\Url;
use Drupal\facets\FacetInterface;
use Drupal\facets\Result\ResultInterface;
use Drupal\oe_list_pages\FacetManipulationTrait;
<?php
namespace Drupal\ema_document\Plugin\media\Source;
use Drupal\file\FileInterface;
use Drupal\media\MediaInterface;
use Drupal\media\MediaTypeInterface;
use Drupal\media\MediaSourceBase;
use Drupal\media\Plugin\media\Source\File as FileBase;
<?php
namespace Drupal\ema_document\Plugin\media\Source;
use Drupal\media\MediaInterface;
use Drupal\media\MediaSourceBase;
/**
* EMA file entity media source.
*