文章

顯示從 7月, 2024 起發佈的文章

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'

CSS Editor Extend

 composer require 'drupal/css_editor:^2.0'

[fix] XAMPP phpmyadmin(mysql) Column count of mysql.proc is wrong. Expected 20, found 16. The table is probably corrupted

  Column count of mysql.proc is wrong. Expected 20, found 16. The table is probably corrupted run: /Applications/XAMPP/xamppfiles/bin/ mysql_upgrade you'll see " ERROR 1010 (HY000): Error dropping database (can 't rmdir ' . / db_name ', errno: 66) .. not empty " go to  / Applications / XAMPP / xamppfiles / var / mysql & delete the  corresponding folder with name as same as the DB