Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Drupal 9

By editor , 2 February, 2024

Unit test with Drupal using PHPUnit (Drupal 10)

Tags

  • Drupal 8
  • Testing
  • Drupal 9
  • Drupal 10

Drupal testing framework (PHPUnit) provide 3 types of tests: UnitTest, KernelTest, FunctionalTest (JSFunctionalTest)
UnitTest : Very fast but Unit Only, without drupal.
KernelTest : Is a service test with drupal but without interfaces ans theming.

By editor , 4 September, 2023

CKEditor inline image files usage for custom forms.

Tags

  • Drupal 10
  • Code
  • Drupal 9
  • Images

Example with CKEditor WYSIWYG inline images field.

Also see : Create a Form with Drupal 8 using Form API

 

By nuwantha , 1 June, 2022

Drupal Security Best Practices

Tags

  • Drupal 8
  • Drupal 9
  • Security

1. Update drupal core and contrib odules to the last version
Example with composer if you use core-recommended:
composer update  drupal/core-recommended:9.3.14 -W

By editor , 8 March, 2022

Order and sort items with tabledrag

Tags

  • Drupal 8
  • Code
  • Drupal 9
  • Table

Draggable table Form Example


Step 1 : Form build

By editor , 4 November, 2021

Conditional Form Fields (States)

Tags

  • Drupal 8
  • Code
  • Drupal 9

Doc : https://www.drupal.org/docs/drupal-apis/form-api/conditional-form-fields

States that can be applied to a form field element:

By editor , 3 November, 2021

Add Zip package to drupal using composer (Example : CKEditor colorbutton as drupal-library)

Tags

  • Drupal 8
  • Drupal 9
  • Composer

Add following packages to composer.json file next to drupal repository

By editor , 30 September, 2021

Translation API - PHP Twig JavaScript

Tags

  • Drupal 8
  • Drupal 9
  • Translation
  • JavaScript
  • Twig
  • PHP

PHP Class using StringTranslationTrait

StringTranslationTrait allow to get t() and formatPlural() methods
Example:
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
class MyClass {

By editor , 13 August, 2021

Import config file programmatically on Drupal 9

Tags

  • Drupal 9
  • Code
  • Configuration

Import configuration file programmatically on Drupal 9 using config_update contrib module and service

//Update Module settings
\Drupal::service('config_update.config_update')->revert('system.simple', 'mymodule.settings');

By editor , 24 June, 2021

State API

Tags

  • Drupal 8
  • Code
  • Drupal 9

State servic eallow to store variables such as state of the server temporarily or permanently

By editor , 19 January, 2021

Drupal error due to DrushLog

Tags

  • Drupal 9
  • Error

Symptoms

You may have error messages like:

Pagination

  • 1
  • Next page
Drupal 9

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer