private $service;
public function __construct($service) {
$this->service = $service;
}
Call to a member function ...() on null in Drupal\...\Form\...->buildForm()
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
https://symfony.com/doc/current/setup.html#creating-symfony-applications |
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
.parent { | |
gap: 20px; | |
.each-item { | |
@supports (-webkit-touch-callout: none) and (not (translate: none)) { | |
margin-top: 20px; | |
margin-right: 20px | |
} | |
} | |
// on desktop |
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
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 |
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_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") { |
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_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'; |
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_mail(). | |
*/ | |
function MY_MODULE_mail($key, &$message, $params) { | |
if ($key == 'MY_KEY') { | |
$fid = 4; // For example | |
$file = File::load($fid); | |
$message['params']['attachments'][] = [ |
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_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
See https://blog.acromedia.com/making-drupal-code-standards-work-for-you-with-phpstorm-phpcs-phpcbf
- PHP Code Sniffer:
- Install Coder
NewerOlder