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 editor , 19 October, 2016

Drupal 8 RESTful Web Services

Tags

  • Drupal 8
  • Code
  • WebService

Step 1: Activate RESTful Webservice

Active modules:
HAL (hal)
RESTful Web Services (rest)    
HTTP Basic Authentication (basic_auth)

Download and active contrib modules:
REST UI (restui)

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 , 11 October, 2016

Custom Views Data handler for a custom Entity on drupal 8

Tags

  • Drupal 8
  • Code
  • Entity
  • Views

Once created your entity as Basic Entity or Full Entity, you can add a custom views handler.

By editor , 10 October, 2016

Create a custom Content Entity on drupal 8 (Full)

Tags

  • Drupal 8
  • Code
  • Entity

This is a full Example of the Entity 'Vehicle' with user interfaces for:
- Actions (Create, Edit, Delete)
- Listing builder
- Entity settings pages
   - Manage fields
   - Manage form display
   - Manage display

 

By editor , 10 October, 2016

Create a custom Content Entity on drupal 8 (Basic)

Tags

  • Drupal 8
  • Code
  • Entity

Drupal 8 has two type of entities, ContentEntity and ConfigEntity. Content entity is based on database table and config entity is based on Drupal config table.

By editor , 7 October, 2016

CSS Font Styling

Tags

  • CSS
  • Code
  • Theming

Standard weights:

medium -> font-weight : 500;
semi-bold ->font-weight : 600;

Font Face

Example

By editor , 4 October, 2016

HTML Entity Decode and Encode

Tags

  • Drupal 8
  • Code
  • Drupal 7
  • PHP

Basic php and drupal 7 / 8 Examples

1.
$string_out = html_entity_decode($string, ENT_QUOTES, 'UTF-8')
//Do not forget ENT_QUOTES and 'UTF-8', otherwise quotes will not decodes.

By editor , 4 October, 2016

Drupal Utility Components and functions

Tags

  • Drupal 8
  • Code
  • Utility

Drupal Utility list

ArgumentsResolver, ArgumentsResolverInterface, Bytes, Color, Crypt, DiffArray, Environment, Html, Image, NestedArray, Number, OpCodeCache, Random, Rectangle, SafeMarkup, SortArray, Tags, Timer, ToStringTrait, Unicode, UrlHelper, UserAgent, Variable, Xss

Pagination

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