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

Code

By editor , 29 June, 2017

Drupal coding Standard and Best Practice

Tags

  • Drupal 8
  • Code
  • Debug
  • Module


Create a Drupal 8 module is a good idea, but develop as Drupal is BEST.

The famous tools PhpCS and PhpCBF allow you to check and correct (some) drupal coding standards and best practice errors.

By editor , 13 June, 2017

Create a custom DRUSH command on drupal 8

Tags

  • Drupal 8
  • Code
  • Drush
  • Module

To create a custom drush command, you must create a custom module like this (Here, mymodule).

By editor , 13 June, 2017

Alter table structure on Drupal 8

Tags

  • Drupal 8
  • Code
  • Database
  • Module

To update a table you must create a custom module. Example , Here we use mymodule.

By editor , 10 June, 2017

PHP : Get Class Name

Tags

  • Module
  • Code
  • PHP

The structure of the examples are like:
namespace Drupal\mymodule\Tools;
class MyTools extends MyToolsBase {
...
}
...
class MyToolsBase {
  public function showClass() {
    $class_name = ....

By editor , 7 June, 2017

Drupal 8 Plugin API

Tags

  • Drupal 8
  • Code
  • Plugin

Drupal 8 embedded with a plugin system. In drupal 8, Plugin is a group of PHP classes used for a defined specific usage. You can use any registered  plugins, add new plugins and also create your own plugin type.

By editor , 7 June, 2017

Test modules using drupal "Testing" System.

Tags

  • Drupal 8
  • Code
  • Testing

SimpleTest (Testing) allow to test your drupal systems in a safe way. It's also allow you to check functionaleties, result ... of your module.

First of all you must active Testing module on your envirenement.
#Drush command:
drush en simpletest -y

By editor , 7 June, 2017

Drupal 8 Module Settings and Mapping

Tags

  • Drupal 8
  • Code
  • Module

For the examples, here we use the module simple_analytics as example.
Module name : simple_analytics
Configuration object: simple_analytics.settings

Settings and mapping files structure.

By editor , 7 June, 2017

Drupal Configuration System (Config API)

Tags

  • Drupal 8
  • Code
  • Module

Drupal 8 embedded with a configuration system which allow users to store variables in the database and usable in site wide as variables in drupal 7. Intend of use variable_set variable_get variable_del, in drupal 8 use Configuration API.

By editor , 6 June, 2017

Run JavaScript code via web browser console.

Tags

  • Drupal 8
  • Code
  • JavaScript
  • Features

Note : Following examples are tested on FireFox Version 52.

Open Web browser console. F12

Method 1 . Press F12 and click on "Console"
Method 2 . Press Ctrl + Shift + K

By editor , 5 June, 2017

Views template suggestion files

Tags

  • Drupal 8
  • Code
  • Views
  • Theming

All views templates can be overridden with a variety of names, using the view, the display ID of the view, the display type of the view, or some combination thereof.

Pagination

  • Previous page
  • 5
  • Next page
Code

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