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 , 18 May, 2016

JSON Encode and Decode

Tags

  • Drupal 8
  • Code
  • JSON

Example :

use Drupal\Component\Serialization\Json;
$json = Json::encode($data);
$data = Json::decode($json);

By editor , 18 May, 2016

Call URL on Drupal 8, Like drupal_http_request() on D7

Tags

  • Drupal 8
  • Code

Example :

By editor , 17 May, 2016

Migrate from Drupal7 to Drupal8

Tags

  • Drupal 8
  • Code
  • Drush

Example (basic)

drush migrate-upgrade --legacy-db-url=mysql://user:password@server/db --legacy-root=http://mydrupal6or7site.com

By editor , 11 May, 2016

Add twig template to a custom Module, Block or Page

Tags

  • Drupal 8
  • Code
  • Theming
  • Twig

Step 1. Create your module and Block (/tutoriels/107/create-a-simple-block-programmatically)

Step 2. Add your template usin hook_theme()  (here module name = clock)

By editor , 10 May, 2016

Add Remove Fields Dynamically using Form API and Ajax

Tags

  • Drupal 8
  • Code
  • Form

Example: Add/Remove 'test' Field depending on 'switch' field

By editor , 8 May, 2016

Install and Update Drush on Linux

Tags

  • Drupal 8
  • Code
  • Drush
By editor , 26 April, 2016

Replacement Patterns

Tags

  • Drupal 8
  • Code
  • Views

Examples of Available replacement patterns:

[title] ==
[body] == Body
[body-value] == Raw value
[body-summary] == Raw summary
[body-format] == Raw format

 

By editor , 18 April, 2016

Compare Two entity programmatically

Tags

  • Drupal 8
  • Code
  • Drupal 7

Example:

By editor , 15 April, 2016

Views with custom Tables - hook_views_data

Tags

  • Drupal 8
  • Code
  • Views
  • Hook

 

Officiel Documentation :

 https://api.drupal.org/api/drupal/core!modules!views!views.api.php/function/hook_views_data/8

 

Use multiple database conncetion with views_data() 

For that you must add 'database'

By editor , 14 April, 2016

Create new content type programmatically using Configuration API

Tags

  • Drupal 8
  • Code
  • Module

Module Name = my_module
Content Type = my_new_content

Create content type

Put this two files into my_module/config/install/

Pagination

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