Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Drupal 9 loop term objects to retrieve term data (id, name, uuid)

// Get an array of term objects for the given vocabulary
$terms = Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['vid' => 'my_vocabulary_machine_name']);


if (!empty($terms)) {

  foreach ($terms as $term) {
    //Only return comments that "published" status.
    if ($term->status->value == 1) {
      // These assignments show how to
      // get the term's id, name, and uuid.
      $terms_array[] = [
        'term_tid' => $term->id(),
        'term_name' => $term->name->value,
        'term_uuid' => $term->uuid->value,
      ];
    }
  }

}
Comment

PREVIOUS NEXT
Code Example
Php :: stupidity 
Php :: php if 2 files in dir unlink the olderst 
Php :: add backslash to path wordpress 
Php :: When I try to run my code in chrome, i see the code that I have made in phpstorm and not the function that it has to do 
Php :: IlluminateDatabaseQueryException SQLSTATE[HY000]: General error: 3780 Referencing column 
Php :: laravel many to many relationship with pivot table 
Php :: illuminate routing array to string conversion 
Php :: backend/index.php when deploying 
Php :: radio checked according to previous data in latravel 
Php :: laravel softdeletes not working giving empty data 
Php :: switch php version ubuntu 20.04 site:stackoverflow.com 
Php :: Convert English Date Time To Persian Date Time JDF PHP 
Php :: bin2hex (PHP 4, PHP 5, PHP 7, PHP 8) 
Php :: php get header language 
Php :: Total Number Of Words 
Php :: trim string in php codeigniter 
Php :: wordpress function _() not working 
Php :: Add text below product title on archive page + ACF 
Php :: laravel eloquent query with orderBy subquery 
Php :: woocommerce update_status() email 
Php :: php artisan reset --force 
Php :: prevent undefined offset php 
Php :: codeigniter pagination example 
Php :: laravel task scheduler error 
Php :: database interaction in codeigniter 
Php :: shopware php get cookie 
Php :: display product page title in field cf7 
Php :: wc php retrieve the order Id on Order pay page 
Php :: laravel select option form add please select option 
Php :: Debloat Wordpress 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =