Theme Negotiators - Switch theme dynamically
Create a custom module (here : example)
For active themes by route you first have to define a service in your $module.services.yml file:
On example.services.yml
Add:
Create a custom module (here : example)
For active themes by route you first have to define a service in your $module.services.yml file:
On example.services.yml
Add:
Get the default cache bin
$cache = \Drupal::cache();
To get a particular cache bin (here 'render'):
$render_cache = \Drupal::cache('render');
Active modules:
HAL (hal)
RESTful Web Services (rest)
HTTP Basic Authentication (basic_auth)
Download and active contrib modules:
REST UI (restui)
You can call drupal 8 services statically as D7, but it is not the best practice (Like Here).
Example : $uuid = \Drupal::service('uuid')->generate();
1. Create a custom module (here : mytest)
2. Create the service Class
Example: src/MTService.php
$services = \Drupal::getContainer()->getServiceIds();
//Generate a new UUID$uuid = \Drupal::service('uuid')->generate();
Once created your entity as Basic Entity or Full Entity, you can add a custom views handler.
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
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.
1.$string_out = html_entity_decode($string, ENT_QUOTES, 'UTF-8')
//Do not forget ENT_QUOTES and 'UTF-8', otherwise quotes will not decodes.