简体   繁体   中英

Query Paragraph Type in Drupal 8

I am trying to Query all paragraphs of a certain type but I am not getting any output. Is my query right? Currently being returned an empty array.

$query = $this->node->getQuery()
          ->condition('type', 'my_paragraph_type')
          ->execute();
        $this->logger->info('query: ' . json_encode($query));

Try with entityQuery('entity_type')

$pids = \Drupal::entityQuery('paragraph')
  ->condition('type', 'my_paragraph_type')
  ->execute();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM