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 , 26 August, 2016

Tips for Form API of Drupal 8

Tags

  • Drupal 8
  • Drupal 7
  • Code
  • Form

Add html after a field

(#field_prefix and #field_suffix).

By editor , 22 August, 2016

Change Drupal 8 text field maximum length

Tags

  • Drupal 8
  • Code
  • Drupal 7
  • Database

If there no data, You can use field_update_field (tested on D7) Like:

By editor , 8 July, 2016

Create a simple module to use Drupal 8 Hook System

Tags

  • Drupal 8
  • Code
  • Module
  • Hook

Drupal 8 Hook System

Hooks allow modules to alter the drupal core behavior or another module. Hooks are discovered and called at specific times to alter or add to the base behavior or data (invoking the hook). Each hook has a name start with hook_ (Ex; hook_menu()).

By editor , 7 July, 2016

Create a new Plugin type using Drupal 8 Plugin API

Tags

  • Drupal 8
  • Code
  • Plugin

Create a new Plugin Type in Drupal 8

Example from Drupal 8 example module, Thank you.
See the Drupal 8 'Example' contrib module for full details and source

Module name : 'plugin_type_example'

By editor , 7 July, 2016

Drupal 8 Services and dependency injection

Tags

  • Drupal 8
  • Code
  • Services

 

Drupal 8 introduces the concept of services to decouple reusable functionality and makes these services pluggable and replaceable by registering them with a service container.

By editor , 7 July, 2016

Drupal 8 Plugin API

Tags

  • Drupal 8
  • Code
  • Plugin

 

Plugins are small pieces of functionality that are swappable. Plugins that perform similar functionality are of the same plugin type.

Link : https://www.drupal.org/developing/api/8/plugins

By editor , 29 June, 2016

Use multiple / external databases in Drupal 8

Tags

  • Drupal 8
  • Code
  • Database

The database settings (and connection) has 3 levels.

1. KEY
2. TARGET
3. DATA

Example:

$databases[KEY][TARGET] = array (
 DATA
);

Like:

By editor , 21 June, 2016

SASS SCSS LESS compile

Tags

  • CSS
  • Code
  • Settings
  • Theming

Compilers

1. COMPASS

Compass is a powerfull command line compiler

Install (Linux debian) : sudo apt-get install ruby-compass

Link : http://compass-style.org/help/documentation/command-line/

2. Koala

By editor , 13 June, 2016

Read a Webpage, Image, File or any url using Drupal 8 httpClient

Tags

  • Drupal 8
  • Code

Use drupal 8 httpClient to read URL.

// Drupal httpClient.
$http = \Drupal::httpClient();
$url = 'http://example.com/';

Example:

$options = array();
$result = $http->request('get', $url, $options);

By editor , 13 June, 2016

Correct a broken HTML file or a HTML String

Tags

  • PHP
  • Code
  • Drupal 8
  • Utility

Example 1 : With DOMDocument: (Fast (0.0002 sec) but can have php warning)

Pagination

  • Previous page
  • 11
  • 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