文章

Create custom block programmatically

how to create a custom block in Drupal 10 https://www.youtube.com/watch?v=1x7ntRl3a74 How to create custom block programmatically in Drupal 9? https://www.youtube.com/watch?v=49psk1jLpYE How to embed inline javascript in Drupal, anywhere on any page https://rikdeboer.medium.com/how-to-dynamically-embed-javascript-in-drupal-anywhere-on-any-page-3f9cd7e64d0c class MyJavascriptBlock extends BlockBase { public function build() { $js = \Drupal::config('mymodule.settings')->get('js_file_url') $tag = '<script type="text/javascript" src="'.$js.'"></script>'; return [ '#markup' => $tag, '#allowed_tags' => ['script'], ]; } }

What is Views, Blocks, Nodes?

 Views: high-level database query list with filter(s) Block: frontend component Node: an individual content

[Fix] - drupal/core is locked to version 10.0.0 and an update of this package was not requested. - drupal/core 10.0.0 requires ext-gd * ->

    on   php.ini   in   /php/php.ini   directory. from ;extension=gd to extension=gd

[Fix] Your lock file does not contain a compatible set of packages. Please run composer upd

composer self-update --2

PHP has to be thread-safe to be able to play ball correctly with Apache!

  PHP has to be thread-safe to be able to play ball correctly with Apache!

highlight.js tradtional script

 <link   rel="stylesheet"   href="./highlight/styles/default.min.css" /> <link   rel="stylesheet"   href="./highlight/styles/github-dark.min.css" /> <script src="./highlight/highlight.min.js"></script> <!-- and it's easy to individually load additional languages --> <script src="./highlight/languages/javascript.min.js"></script> <pre><code class="language-javascript"> function helloWorld() {   console.log('Hello, world!'); } </code></pre> <script> document.addEventListener('DOMContentLoaded', (event) => {   document.querySelectorAll('pre code').forEach((block) => {     hljs.highlightElement(block);   }); }); </script>

Dark Mode CKEditor Extend

 composer require 'drupal/ckeditor5_dark_mode:^1.0'