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 9

By editor , 30 September, 2016

Alter a view. Edit view result programmatically

Tags

  • Drupal 8
  • Code
  • Views
  • Drupal 9

Example : Change title

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 , 15 January, 2016

Create a Form with Drupal 8 using Form API

Tags

  • Drupal 8
  • Code
  • Module
  • Form
  • Drupal 9

Step 1:  Create a module. (Example)

By editor , 23 December, 2015

Page Redirection on Drupal 8 / 9

Tags

  • Drupal 8
  • Code
  • Drupal 9

Example 1. Redirect to the front page:

    return new \Symfony\Component\HttpFoundation\RedirectResponse(\Drupal::url('<front>'));

Example 2. Redirect to a route path (user page):

By editor , 16 December, 2015

Get a Image file path (src) on Drupal 8/9

Tags

  • Drupal 8
  • Code
  • Images
  • Drupal 9

Get the image file src (url)   
    $fid = 1;//The file ID   
    $file = \Drupal\file\Entity\File::load($fid);
    $path = $file->getFileUri();

By editor , 10 December, 2015

Set the page title programmatically in Drupal 9

Tags

  • Drupal 8
  • Code
  • Drupal 9

Change on a form or controller

Just set ['#title'] element.

Form Example : $form['#title'] = "The title";

By editor , 5 December, 2015

Create a custom permission in Drupal 8

Tags

  • Drupal 8
  • Code
  • Permission
  • Drupal 9

Example with a module 'mymodule'

Step 1.
Create if not exist yet, mymodule.permissions.yml (root of mymodule)
Add your new permission like:

By editor , 18 November, 2015

Add CSS stylesheets to a module (CKEditor)

Tags

  • Drupal 8
  • Theming
  • Code
  • Drupal 9

There are several ways to do that.

Pagination

  • Previous page
  • 3
Drupal 9

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