Drupal 8 - Drupal 8 - News - Help - Tutorial - And more... https://drupal8.ovh/en en Translation API - PHP Twig JavaScript https://drupal8.ovh/en/tutoriels/423/translation-api-php-twig-javascript <span class="field field--name-title field--type-string field--label-hidden">Translation API - PHP Twig JavaScript</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to translate interface using drupal translation API ?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Thu, 09/30/2021 - 11:43</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><h2>PHP Class using StringTranslationTrait</h2> <p>StringTranslationTrait allow to get t() and formatPlural() methods<br /> Example:<br /><code>use Drupal\Core\StringTranslation\StringTranslationTrait;<br /> use Drupal\Core\StringTranslation\TranslationInterface;<br /> class MyClass {<br />   use StringTranslationTrait;<br />   /**<br />    * Constructs a MyClass object.<br />    * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation<br />    *   The string translation service.<br />    */<br />   public function __construct(TranslationInterface $string_translation) {<br />     // You can skip injecting this service, the trait will fall back to \Drupal::translation()<br />     // but it is recommended to do so, for easier testability,<br />     $this-&gt;stringTranslation = $string_translation;<br />     $string = $this-&gt;t('Something');<br />   }<br /> }</code></p> <h2>In annotation text</h2> <p>Examples:<br /><code>@Translation("File")<br /> @Translation("Text in context", context="Name of context")</code></p> <h2> In a Java Script (.js file)</h2> <p>Syntax: Drupal.t(str, args, options);<br /> Examples:<br /><code>Drupal.t('May');<br /> Drupal.formatPlural('May');<br /> Drupal.t('May', {}, {context: "Long month name"});</code></p> <h2> In Twig templates</h2> <p>Examples:<br /><code>{{ 'Hello Earth.'|trans }}<br /> {{ 'Hello Earth.'|t }}<br /> {{ 'Hello @username.'|t({'@username': username}) }}<br /> {% trans %}Hello {{username}}.{% endtrans %}<br /> {% set labelText = '@action for @name'|t({'@action': actionText|default('Close')|t,'@name': nameText}) %}</code></p> <p> Doc : https://www.drupal.org/docs/8/api/translation-api/overview</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/drupal-8" hreflang="en">Drupal 8</a></li> <li><a href="/en/tags/drupal-9" hreflang="en">Drupal 9</a></li> <li><a href="/en/tags/translation" hreflang="en">Translation</a></li> <li><a href="/en/tags/javascript" hreflang="en">JavaScript</a></li> <li><a href="/en/tags/twig" hreflang="en">Twig</a></li> <li><a href="/en/tags/php" hreflang="en">PHP</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=423&amp;2=comment&amp;3=comment" token="5OpyzZs99ytOKK5WFfxv_DJhZ6VIDqr0zIGBFnvmwLE"></drupal-render-placeholder> </section> Thu, 30 Sep 2021 09:43:58 +0000 editor 423 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/423/translation-api-php-twig-javascript#comments Import config file programmatically on Drupal 9 https://drupal8.ovh/en/tutoriels/421/import-config-file-programmatically-drupal-9 <span class="field field--name-title field--type-string field--label-hidden">Import config file programmatically on Drupal 9</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Fri, 08/13/2021 - 09:40</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Import configuration file programmatically on Drupal 9 using <strong>config_update</strong> contrib module and service</p> <p><code>//Update Module settings<br /> \Drupal::service('config_update.config_update')-&gt;revert('system.simple', 'mymodule.settings');</code></p> <p><code>// Import a block.<br /> \Drupal::service('config_update.config_update')-&gt;import('block', 'mycustomblock');</code></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/drupal-9" hreflang="en">Drupal 9</a></li> <li><a href="/en/tags/code" hreflang="en">Code</a></li> <li><a href="/en/tags/configuration" hreflang="en">Configuration</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=421&amp;2=comment&amp;3=comment" token="vCZass4HBzX-c-bs4a7YPtP5RbHicPR7DLHYfaPGscI"></drupal-render-placeholder> </section> Fri, 13 Aug 2021 07:40:40 +0000 editor 421 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/421/import-config-file-programmatically-drupal-9#comments State API https://drupal8.ovh/en/tutoriels/420/state-api <span class="field field--name-title field--type-string field--label-hidden">State API</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Thu, 06/24/2021 - 10:52</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>State servic eallow to store variables such as state of the server temporarily or permanently</p> <p><strong>Examples:</strong></p> <p><strong>Read</strong><br /> A single value.<br /><code>$val = \Drupal::state()-&gt;get('key');</code><br /> Multiple key/value pairs.<br /><code>$pairs = \Drupal::state()-&gt;getMultiple($keys);</code></p> <p><strong>Write</strong><br /> A single value.<br /><code>\Drupal::state()-&gt;set('key','value');</code><br /> Multiple values.<br /><code>\Drupal::state()-&gt;setMultiple($keyvalues);</code></p> <p><strong>Remove</strong><br /><code>\Drupal::state()-&gt;delete('key');</code></p> <p> </p> <p>More details : https://www.drupal.org/docs/8/api/state-api/overview</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/drupal-8" hreflang="en">Drupal 8</a></li> <li><a href="/en/tags/code" hreflang="en">Code</a></li> <li><a href="/en/tags/drupal-9" hreflang="en">Drupal 9</a></li> </ul> </div> <div class="field field--name-field-related-contents field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><a href="/en/tutoriels/365/save-temporary-data-key-value-expirable" hreflang="en">Save a temporary data - Key Value Expirable.</a></div> <div class="field__item"><a href="/en/tutoriels/401/private-tempstore-store-data-drupal-9-session" hreflang="en">Private Tempstore - Store data on Drupal 9 session</a></div> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=420&amp;2=comment&amp;3=comment" token="bnA8VHctZ_razUl-QeLTHsE8oLGZ3N8P5rvoiaAl-h4"></drupal-render-placeholder> </section> Thu, 24 Jun 2021 08:52:48 +0000 editor 420 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/420/state-api#comments Drupal Site Settings : Using settings.php https://drupal8.ovh/en/tutoriels/419/drupal-settings-using-settingsphp <span class="field field--name-title field--type-string field--label-hidden">Drupal Site Settings : Using settings.php</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to <code>use <span>Drupal\Core\Site\Settings;</span></code></p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Tue, 06/15/2021 - 11:37</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Drupal settings file can contains variable which can use to use for different configuration in different environments.</p> <p>Example:<br /> env_name<br /> default_info_nid</p> <p><code>$settings['env_name'] = 'Local';<br /> $settings['default_info_nid'] = 1';</code></p> <p><strong>Read the settings</strong></p> <p><code>use Drupal\Core\Site\Settings;</code></p> <p><code>$envName = Settings::get('env_name');<br /> $nid = Settings::get('default_info_nid');</code></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/drupal-8" hreflang="en">Drupal 8</a></li> <li><a href="/en/tags/code" hreflang="en">Code</a></li> <li><a href="/en/tags/settings" hreflang="en">Settings</a></li> </ul> </div> <div class="field field--name-field-related-contents field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><a href="/en/tutoriels/316/drupal-8-module-settings-and-mapping" hreflang="en">Drupal 8 Module Settings and Mapping</a></div> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=419&amp;2=comment&amp;3=comment" token="NwY1uLY56XFtJLkEBMQESrBMYqCc8smfjxAyd3p178s"></drupal-render-placeholder> </section> Tue, 15 Jun 2021 09:37:17 +0000 editor 419 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/419/drupal-settings-using-settingsphp#comments Squash commits into one with Git, Rebase https://drupal8.ovh/en/tutoriels/412/squash-commits-one-git <span class="field field--name-title field--type-string field--label-hidden">Squash commits into one with Git, Rebase</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Tue, 04/06/2021 - 11:02</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Steps:</p> <p>1. Update branche<br /><code>git reset --hard origin/features/BRANCHNAME<br /> OR<br /> git pull origin features/BRANCHNAME</code></p> <p>2. Rebase<br /> git rebase -i HEAD~N --rebase-merges<br /><code>git rebase -i HEAD~2 --rebase-merges<br /> OR<br /> git rebase -i COMMIT-NUMBER --rebase-merges</code></p> <p>3. Change pick by s (Squash) except first</p> <p>4. Comment unwanted comment texts</p> <p>5. Check rebase and push using --force</p> <p> </p> <p><strong><u>Rebase a branch: (Avoid if possible)</u></strong></p> <p>Example :<br /><code>git rebase origin/BRANCH-NAME  --rebase-merges</code></p> <p> </p> <p><u>Other commands:</u></p> <p><code>git rebase --continue</code></p> <p><code>git rebase --abort</code></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/git" hreflang="en">Git</a></li> </ul> </div> <div class="field field--name-field-related-contents field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><a href="/en/tutoriels/343/git-usage-2-cherry-pick-rebase" hreflang="en">Git Usage 2 - Cherry-pick, Rebase</a></div> <div class="field__item"><a href="/en/tutoriels/11/helpful-git-commands" hreflang="en">Helpful git commands</a></div> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=412&amp;2=comment&amp;3=comment" token="ylgREJmWua4dG71o47RcAhs6Wb14xNX87xolS0arLts"></drupal-render-placeholder> </section> Tue, 06 Apr 2021 09:02:07 +0000 editor 412 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/412/squash-commits-one-git#comments Chocolatey packages installer https://drupal8.ovh/en/tutoriels/411/chocolatey-packages-installer <span class="field field--name-title field--type-string field--label-hidden">Chocolatey packages installer</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Tue, 04/06/2021 - 10:51</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Chocolatey is a software manager for Windows. Can use to install packages like php, tig, make</p> <p>Examples:</p> <p>Install php<br /><code>choco install php</code></p> <p>Install TIG<br /><code>choco install tig</code></p> <p>Site : https://chocolatey.org/install</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/windows" hreflang="en">Windows</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=411&amp;2=comment&amp;3=comment" token="g0oEmheXRX1D3iWvm3XKDV53Tx0C_avnEcbOqa5wDTI"></drupal-render-placeholder> </section> Tue, 06 Apr 2021 08:51:44 +0000 editor 411 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/411/chocolatey-packages-installer#comments Convert M4A or OGG audio file in to MP3 on linux https://drupal8.ovh/en/tutoriels/410/convert-m4a-or-ogg-audio-file-mp3-linux <span class="field field--name-title field--type-string field--label-hidden">Convert M4A or OGG audio file in to MP3 on linux</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to convert mp4 or ogg file in to mp3 using ffmpeg</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Mon, 03/08/2021 - 09:42</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p><strong>Convert OGG to MP3</strong></p> <p><code>ffmpeg -v 5 -y -i file.m4a -acodec libmp3lame -ac 2 -ab 192k file.mp3</code></p> <p><strong>Convert M4A to MP3</strong></p> <p><code>ffmpeg -i file.ogg file.mp3<br /> #Or<br /> ffmpeg -i file.{ogg,mp3}</code></p> <p> </p> <p><strong>Batch process (bulk processing - shell/batch script) examples:</strong></p> <p>#Example1<br /><code>for i in *.m4a; do ffmpeg -v 5 -y -i "$i" -acodec libmp3lame -ac 2 -ab 192k "mp3/${i%.*}.mp3"; done</code></p> <p>#Example2<br /><code>for i in *.ogg; do ffmpeg -i "$i" "mp3/${i%.*}.mp3"; done</code></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/shell" hreflang="en">Shell</a></li> <li><a href="/en/tags/linux" hreflang="en">Linux</a></li> <li><a href="/en/tags/audio" hreflang="en">Audio</a></li> </ul> </div> <div class="field field--name-field-related-contents field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><a href="/en/tutoriels/128/images-processing-using-imagemagick-convert" hreflang="en">Images processing using ImageMagick (convert)</a></div> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=410&amp;2=comment&amp;3=comment" token="oOijBNrAcwacW5Jzi9cdJXhDUcT6-I1gZG11Qg1hiRA"></drupal-render-placeholder> </section> Mon, 08 Mar 2021 08:42:34 +0000 editor 410 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/410/convert-m4a-or-ogg-audio-file-mp3-linux#comments Create a shortcut for drush https://drupal8.ovh/en/tutoriels/408/create-shortcut-drush <span class="field field--name-title field--type-string field--label-hidden">Create a shortcut for drush</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>Different possibilities to run drush (drush 10)</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Thu, 01/21/2021 - 11:23</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Method 1 : Install and run drush as described in <a data-entity-substitution="canonical" data-entity-type="node" data-entity-uuid="2aeee871-aa09-4d91-a6f8-12028d04cf14" href="/en/tutoriels/397/install-drush-10" rel="nofollow">this article</a><br /> This is the recommended method</p> <p>Method 2 : Create a shortcut on ~/.local/bin</p> <p>1. Create a link to drush exec file on ~/.local/bin<br /> Example:<br /><code>cd ~/.local/bin</code><br /> ln -s 'PATH TO DRUSH BIN'<br /> Example:<br /><code>ln -s /home/drupal/.config/composer/vendor/bin/drush</code></p> <p>2. If not added yet, add ~/.local/bin folder to env path (<a data-entity-substitution="canonical" data-entity-type="node" data-entity-uuid="54e090c1-d493-441b-babb-b29c75c8848a" href="/en/tutoriels/407/linux-local-and-common-bin-folders" rel="nofollow">Tutorial</a>) to load automaticly or load manually like<br /><code>PATH=$PATH:$HOME/.<span><span><span><span><span><span><span><span><span><span><span><span><span><span><span>local</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>/bin:$HOME/bin<br /> export PATH</code></p> <p>Methos 3 : Create shorcut on .bashrc<br /> Edit ~.bashrc file and add (For example)<br /><code>alias drush='PATH TO DRUSH BIN'</code><br /> Example:<br /><code>alias drush='/home/drupal/.config/composer/vendor/bin/drush'</code></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/drush-10" hreflang="en">Drush 10</a></li> <li><a href="/en/tags/linux" hreflang="en">Linux</a></li> </ul> </div> <div class="field field--name-field-related-contents field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><a href="/en/tutoriels/397/install-drush-10" hreflang="en">Install drush 10</a></div> <div class="field__item"><a href="/en/tutoriels/407/linux-local-and-common-bin-folders" hreflang="en">Linux local and common bin folders (environnement path)</a></div> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=408&amp;2=comment&amp;3=comment" token="1FLCSGVj7xXhPvRbOQmZwOODH-n4t0MiFgzaleT8XXk"></drupal-render-placeholder> </section> Thu, 21 Jan 2021 10:23:53 +0000 editor 408 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/408/create-shortcut-drush#comments Linux local and common bin folders (environnement path) https://drupal8.ovh/en/tutoriels/407/linux-local-and-common-bin-folders <span class="field field--name-title field--type-string field--label-hidden">Linux local and common bin folders (environnement path)</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Thu, 01/21/2021 - 11:16</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Local bin folders<br /> $HOME/.local/bin (~/.local/bin)<br /> $HOME/bin (~/bin)</p> <p>Add to path manually</p> <p><code>PATH=$PATH:$HOME/.local/bin:$HOME/bin<br /> export PATH</code></p> <p> </p> <p>User specific environment and startup programs</p> <p>1. Edit and add to one of the following files<br /> .bash_profile<br /> .profile<br /> .bashrc</p> <p><code>PATH=$PATH:$HOME/.local/bin:$HOME/bin<br /> export PATH</code></p> <p>To load a file manually the file .bashrc<br /><code>. ~/.bashrc</code></p> <p> </p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/linux" hreflang="en">Linux</a></li> <li><a href="/en/tags/shell" hreflang="en">Shell</a></li> </ul> </div> <div class="field field--name-field-related-contents field--type-entity-reference field--label-hidden field__items"> <div class="field__item"><a href="/en/tutoriels/408/create-shortcut-drush" hreflang="en">Create a shortcut for drush</a></div> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=407&amp;2=comment&amp;3=comment" token="Co8H6fqyn-6fBn70WxqmB1nO_JQA3iQA4qujWtQzLjk"></drupal-render-placeholder> </section> Thu, 21 Jan 2021 10:16:57 +0000 editor 407 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/407/linux-local-and-common-bin-folders#comments Drupal error due to DrushLog https://drupal8.ovh/en/tutoriels/406/drupal-error-dur-drushlog <span class="field field--name-title field--type-string field--label-hidden">Drupal error due to DrushLog</span> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Tue, 01/19/2021 - 17:42</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Symptoms</p> <p>You may have error messages like:</p> <p>The website encountered an unexpected error. Please try again later.<br /> and<br /><code>Error: Class 'Drush\Log\DrushLog' not found in Drupal\Component\DependencyInjection\Container-&gt;createService() (line 257 of /home/drupal/public_html/www/web/core/lib/Drupal/Component/DependencyInjection/Container.php) </code></p> <p><strong>probably this is due to DrushLog class.</strong></p> <p> </p> <p>Solution.</p> <p>Include the package drush/drush<br /><code>composer require drush/drush</code></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/drupal-9" hreflang="en">Drupal 9</a></li> <li><a href="/en/tags/error" hreflang="en">Error</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=406&amp;2=comment&amp;3=comment" token="9CACdDhKCUOPeusa8Mi4rpE-ke7g9WLNNMDA5PrQkwg"></drupal-render-placeholder> </section> Tue, 19 Jan 2021 16:42:38 +0000 editor 406 at https://drupal8.ovh https://drupal8.ovh/en/tutoriels/406/drupal-error-dur-drushlog#comments