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

Entity

By editor , 23 May, 2018

Search Entities when using Domain Access

Tags

  • Drupal 8
  • Code
  • Entity

Example 1 : Without changing user session.

$query = \Drupal::entityQuery('node');
$query->condition(DOMAIN_ACCESS_FIELD, 'domain_id'); // Set the domain id hear
$query->condition('type', 'article');
$query->condition('status', 1);

By editor , 10 February, 2017

Load entity dynamicly by entity type on Drupal 8

Tags

  • Drupal 8
  • Code
  • Entity

Using entity_load function.

Example:
$entity = entity_load($entity_type, $id);

Using Entity Manager

Example:
$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($id);

By editor , 10 January, 2017

Get Entity data and metadata

Tags

  • Drupal 8
  • Code
  • Entity

Get entity types list :

$itmes_list= \Drupal::entityTypeManager()->getDefinitions();

Get Entity type (Content / Config)

$itmes_list['node']->getGroup();
$itmes_list['node_type']->getGroup();

By editor , 12 November, 2016

Custom Content Entity Field types of drupal 8

Tags

  • Drupal 8
  • Code
  • Entity
  • Database
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 , 30 September, 2016

Edit and Update Entity schema on drupal 8

Tags

  • Drupal 8
  • Code
  • Entity

Add a new field:

Example 1 Automatic update:

1. Update baseFieldDefinitions() of the Entity.
2. Apply update from a mymodule_update_N(). Ex:

Entity

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