Skip to content

Instantly share code, notes, and snippets.

https://symfony.com/doc/current/setup.html#creating-symfony-applications
.parent {
gap: 20px;
.each-item {
@supports (-webkit-touch-callout: none) and (not (translate: none)) {
margin-top: 20px;
margin-right: 20px
}
}
// on desktop
Allow other domain do Rest request to drupal site:
- Use `services.yml`:
```
cors.config:
enabled: true
# Specify allowed headers, like 'x-allowed-header'.
allowedHeaders: ['*'] # All header
# Specify allowed request methods, specify ['*'] to allow all possible ones.
allowedMethods: ['GET'] # Methods
<?php
/**
* Implements hook_field_widget_multivalue_form_alter().
*/
function MODULE_NAME_field_widget_multivalue_form_alter(&$elements, FormStateInterface $form_state, $context) {
$field = $context['items']->getName();
$build_info = $form_state->getBuildInfo();
if ($field == "FIELD_NAME") {
<?php
/**
* Implements hook_locale_translation_projects_alter().
*/
function MODULENAME_locale_translation_projects_alter(&$projects) {
$path_module = drupal_get_path('module', 'MODULENAME');
$path_translation = $path_module . '/translations/%language.po';
private $service;

public function __construct($service) {
  $this->service = $service;
}

Call to a member function ...() on null in Drupal\...\Form\...->buildForm()
<?php
/**
* Implements hook_mail().
*/
function MY_MODULE_mail($key, &$message, $params) {
if ($key == 'MY_KEY') {
$fid = 4; // For example
$file = File::load($fid);
$message['params']['attachments'][] = [
<?php
/**
* Implements hook_update().
*/
function MODULE_NAME_update_800X(&$sandbox) {
// Use the sandbox at your convenience to store the information needed
// to track progression between successive calls to the function.
if (!isset($sandbox['progress'])) {
// The count of nodes visited so far.

Edit /home/rpayanm/Programs/PhpStorm/bin/phpstorm.sh and add at the top:

XMODIFIERS=phpstorm.sh
export XMODIFIERS