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

Services

By editor , 12 January, 2022

Add a custom service YAML container

Tags

  • Drupal 8
  • Code
  • Settings
  • Services
  • YAML

Example: settings for local environnement.
Create the local settings file : local.services.yml the add to local settings.php file

# Local service config
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/default/local.services.yml';

By editor , 13 June, 2018

Connect to a PPTP VPN Server from Linux Terminal

Tags

  • Linux
  • Services

Step 1 : Install pptp client.

sudo apt-get -y install pptp-linux


Step 2 : Setup PPTP Client

Add secret:

File : /etc/ppp/chap-secrets
You can use:
sudo nano /etc/ppp/chap-secrets

By editor , 23 May, 2018

Switch user sessions using Account Switcher service

Tags

  • Drupal 8
  • Code
  • Services

Example:

By editor , 19 January, 2018

Event dispatcher. Create event, Dispatch and Subscribe.

Tags

  • Drupal 8
  • Code
  • Module
  • Services
  • Hook

Drupal's event system allow to create triggers when an event has been happened like create a custom hook on drupal 7.

By editor , 19 January, 2018

Event Subscriber to replace hook_boot and hook_init

Tags

  • Drupal 8
  • Code
  • Services
  • Hook

Use Event Subscriber service.

The EventSubscriber allow to execute an action on boot as hook_boot or hook_init of drupal 7.

Example.

By editor , 13 October, 2016

Use Drupal 8 Service and Dependency Injection, Autowire

Tags

  • Drupal 8
  • Code
  • Services

You can call drupal 8 services statically as D7, but it is not the best practice (Like Here).
Example : $uuid = \Drupal::service('uuid')->generate();

By editor , 13 October, 2016

Create a custom Service

Tags

  • Drupal 8
  • Code
  • Services

Create a Service on Drupal 8

1.  Create a custom module (here : mytest)

2. Create the service Class
Example: src/MTService.php

By editor , 11 October, 2016

Drupal 8 Service

Tags

  • Drupal 8
  • Code
  • Services

Get All available services list

$services = \Drupal::getContainer()->getServiceIds();

Few use full services

//Generate a new UUID
$uuid = \Drupal::service('uuid')->generate();

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.

Services

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