Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Drupal 9 entity.repository load entity by UUID

use SymfonyComponentHttpKernelExceptionHttpException;

$node_uuid = 'UUID STRING HERE';
try {
  $node = Drupal::service('entity.repository')->loadEntityByUuid('node', $node_uuid);
  $nid = $node->id();
  unset($node);

} catch (Exception $e) {
  throw new HttpException(400, 'Node UUID does not match one in the system.');
}
Comment

PREVIOUS NEXT
Code Example
Php :: storefront remove sidebar from product page 
Php :: laravel FacadesDB update 
Php :: php get locale active 
Php :: install composer laravel 
Php :: php extend class 
Php :: doble quotes in csv export php 
Php :: enable trash for media wordpress 
Php :: array random php 
Php :: wpdb get column 
Php :: adjacent post sort order by post title 
Php :: wordpress get the short permalink 
Php :: bootstrap autocomplete example laravel 
Php :: PHP - AJAX and MySQL 
Php :: php date text in middle 
Php :: heroku deploy php 
Php :: php split 
Php :: laravel hide columns 
Php :: map array php 
Php :: Uninitialized string offset 
Php :: php use curl 
Php :: php preg match 
Php :: hot to use functions in heredoc 
Php :: square root 
Php :: guzzle download file 
Php :: PHP Iterables 
Php :: laravel create method 
Php :: livewire model bind item in array 
Php :: laravel use npm package 
Php :: include JS or Css in wordpress plugin 
Php :: how to migrate new column without empty the table in laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =