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 Anonymous (not verified) , 10 June, 2016

Database Basic Examples (Select, Merge, Insert ...)

Tags

  • Drupal 8
  • Code
  • Database
  • Drupal 9

Select:
    $con = \Drupal\Core\Database\Database::getConnection();
    $query = $con->select('table_name', 't')
        ->fields('t', ['field_1', 'field_2']);

By editor , 10 June, 2016

Cache Drupal 8 Render Arrays

Tags

  • Drupal 8
  • Code
  • Cache

Cache configuration of a renderer array (Just an exaple)

By editor , 8 June, 2016

Drupal Behaviors - JavaScript and jQuery

Tags

  • Drupal 8
  • Code
  • JavaScript
  • jQuery

What is drupal behaviors ?

Drupal behaviors allow to execute javascpts in particular context and / or pass data from drupal to client side java script.

By editor , 7 June, 2016

Drupal 8 Tags based cache system

Tags

  • Drupal 8
  • Code
  • Cache
  • Module

This system allow you to invalidate drupal cache using a 'tag'

Exapples:

By editor , 4 June, 2016

Inline template with Drupal 8 and Twig

Tags

  • Drupal 8
  • Code
  • Theming
  • Twig

Example 1. Basic inline template

    $output[] = [
      '#type' => 'inline_template',
      '#template' => '{{ yourvar }}',
      '#context' => [

By editor , 31 May, 2016

Change Drupal 8 'Powered By' block

Tags

  • Drupal 8
  • Code
  • Module

You can't change the body of this block fron the user interface. But you can do that using a small custom module using hook_block_view_alter().

Example: in the yourmodule.module

By editor , 29 May, 2016

Find Entity using Drupal EntityQuery

Tags

  • Drupal 8
  • Code
  • Module

You can find any entity using Drupal 8 EntityQuery System.

By editor , 26 May, 2016

Make a Link list and Submenu

Tags

  • Drupal 8
  • Code
  • Module

Example:

1. in yourmodule.links.menu.yml
yourmodule.test:
  title: Test
  parent: system.admin_config_development
  route_name: yourmodule.test

By editor , 25 May, 2016

Cache Clearing and rebuilding methods for Drupal 8

Tags

  • Drupal 8
  • Code
  • Server
  • Drush
  • Cache

Site URL

1. Go to Administration > Configuration > Development > Performance
 (/admin/config/development/performance)
2. Click on "Clear all caches"

By editor , 20 May, 2016

Render Custom field with Drupal Renderer

Tags

  • Drupal 8
  • Code
  • Twig
  • Images

Example 1, with FieldPluginBase (\Drupal\views\Plugin\views\field\FieldPluginBase)

Pagination

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