Create own service for your module in Drupal 8


It is always good to know how to use core services and as well how to create your own service. Following code snippet can help you to do that.

Create custom service into modulename.service.yml

services:
  content_connected.manager:
    class: Drupal\content_connected\ContentConnectedManager
    arguments: ["@entity.manager", "@config.factory","@entity.query", "@module_handler","@renderer","@string_translation"]

You can see the details code in (http://cgit.drupalcode.org/content_connected?h=8.x-1.x)

Module link :- https://www.drupal.org/project/content_connected

Advertisements

,

  1. Leave a comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: