Drupal architecture
Drupal's architecture is built on a modular framework that provides flexibility and extensibility. Key components of the Drupal architecture include:
Drupal's architecture is built on a modular framework that provides flexibility and extensibility. Key components of the Drupal architecture include:
Create in module directory file named drush.services.yml with similar content:
services:
custom_base.commands:
class: Drupal\custom_base\Commands\CustomCommands
arguments:
- '@config.factory'
- '@entity_type.manager'
- '@database'
tags:
- { name: drush.command }
In Drupal\custom_base\src\Commands need to create file CustomCommands.php:
To remove files from the GIT repository based on .gitignore, without deleting them from the local file system:
git ls-files -i -c -X .gitignore | xargs git rm --cached
launchctl unload /Users/dmitry/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
brew services restart mariadb
sudo nano /opt/homebrew/etc/my.cnf
Programaticaly restore admin user could be done with this code:
use Drupal\user\Entity\User;
$user = User::create([
'name' => 'admin',
'mail' => 'admin@example.com',
'status' => 1,
'roles' => ['administrator'],
'pass' => 'newpassword',
]);
$user->save();
<h1>{{ 'Hello world'|t }}</h1>
<div class="mt-3 alert alert-warning">
<p>{% trans %}Do you know how translation works?{% endtrans %}</p>
</div>
Using translate function with parameters:
{{ 'Last checked: @time ago'|t({'@time': time}) }}
{{ "Text to translate"|t({}, {'context' : 'Context name'}) }}
and
Load Order and change it status to "Cancelled":
$order = \Drupal::entityTypeManager()
->getStorage('commerce_order')
->load(1);
$order->getState()->applyTransitionById('cancel');
$order->save();
solved with this
chmod -R ugo+rwx files/
chmod -R ugo+rwx private/
chmod -R ugo+rwx tmp/
arch -arm64 sudo pecl install xdebug
last working with php 7.4 is 3.1.6
arch -arm64 sudo pecl install xdebug-3.1.6
[Xdebug]
;xdebug.start_with_request=default
;xdebug.idekey=PHPSTORM
xdebug.client_port=9090
xdebug.mode=debug
zend_extension="xdebug.so"
To detect if there are any errors:
nginx -T
To fix 504 Timeout error:
upstream timed out: fastcgi_read_timeout 600s;
To fix error "upstream sent too big header while reading response header from upstream" need to append the following directives:
fastcgi_buffers 16 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;
#fastcgi_buffering off;
large_client_header_buffers 4 8k;