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 8

By editor , 11 May, 2017

YAML or JSON

Tags

  • Drupal 8
  • Code
  • JSON
  • YAML

Yml vs Json

A make a small test to test YAML vs PHP performance. The result is:

By editor , 24 April, 2017

Drupal 8 Cache contexts

Tags

  • Drupal 8
  • Code
  • Cache

Drupal 8 shiped with a powerfull cache API able to set cache according to a context. correct usage of this cache improve the site preformence greatly.

https://www.drupal.org/docs/8/api/cache-api/cache-contexts
https://www.drupal.org/node/2451661

By editor , 24 April, 2017

Memcache - Install memcached on linux and Drupal.

Tags

  • Drupal 8
  • Code
  • Cache
  • Server

Memcache is caching server allow you to incrise and have great performence on your site. Drupal and memcached work very well and here the full tutorial you need to install and setup memcache server and your drupal instance.

By editor , 29 March, 2017

Few Tips to create a custom module

Tags

  • Drupal 8
  • Code
  • Module

 

Check module exist

if (\Drupal::moduleHandler()->moduleExists('my_module')) {
    $message = 'Module exist.';
}
else {
    $message = 'Not exists.';
}

 

By editor , 16 March, 2017

Avoid Spam form submissions - (Easy way of form Anti-Spam)

Tags

  • Drupal 8
  • Code
  • PHP
  • Form
By editor , 3 March, 2017

Create a View Plugin Without using Database field

Tags

  • Drupal 8
  • Code
  • Module
  • Views

Step 1. Create a custom module and add the HOOK hook_views_data_alter(&$data). Here module : mymodule

Step 2.

By editor , 20 February, 2017

Override 40x System error pages on Drupal 8

Tags

  • Drupal 8
  • Code

You have several mthodes to override 403 / 404 System pages.

Method 1. Set 403 / 404 pages.

You can set the 403 /404 page on "Basic site settings" page
Admin -> Configuration -> System -> Basic site settings
Path /admin/config/system/site-information

By editor , 10 February, 2017

Render a Render array to HTML code.

Tags

  • Drupal 8
  • Code
  • Module

Example :

$result =  array(
  '#markup' => 'Hello. This is my First Page',
);
$renderer = \Drupal::service('renderer');
$html = $renderer->render($result);

 

By editor , 10 February, 2017

Insert a view on a custom page or block

Tags

  • Drupal 8
  • Code
  • Views

This tutorial show toy how to insert an existing views into a custom page or custom block.

 

By editor , 10 February, 2017

Load entity dynamicly by entity type on Drupal 8

Tags

  • Drupal 8
  • Code
  • Entity

Using entity_load function.

Example:
$entity = entity_load($entity_type, $id);

Using Entity Manager

Example:
$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($id);

Pagination

  • Previous page
  • 7
  • Next page
Drupal 8

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