Add report for paragraphs entity types.
2 unresolved threads
Merged
requested to merge issue/content_model_documentation-3503885:3503885-add-report-for into 1.0.x
2 unresolved threads
Closes #3503885
Merge request reports
Activity
- Resolved by Steve Wirt
- Resolved by Steve Wirt
- src/Report/ParagraphCount.php 0 → 100644
154 } 155 156 /** 157 * Gets the count of published nodes. 158 * 159 * @return array 160 * The array of bundles with a published count. 161 */ 162 protected function getBundlePublishedCount() { 163 if ($this->entityTypeExists(self::ENTITY_TYPE)) { 164 $paragraph_types = $this->entityTypeManager->getStorage(self::ENTITY_TYPE)->loadMultiple(); 165 foreach ($paragraph_types as $paragraph_type) { 166 $type_id = $paragraph_type->id(); 167 // Query to count the number of paragraphs of this type. 168 $query = $this->entityTypeManager->getStorage('paragraph')->getQuery(); 169 $query->condition('type', $type_id)->accessCheck(TRUE); This needs to be FALSE so that the report shows the entire site structure, not just the structure that the user looking at the report has permission to see. There is no security risk here because we are not granting access to the specific content, just listing the type and counting the instances.
changed this line in version 2 of the diff
requested review from @swirtMiles
492 492 * TRUE if the entity type is defined, FALSE otherwise. 493 493 */ 494 494 protected function entityTypeExists(string $entity_type_name): bool { 495 return $this->entityTypeManager->hasDefinition("block_content"); 495 return $this->entityTypeManager->hasDefinition($entity_type_name); - Resolved by Steve Wirt
reset approvals from @swirtMiles by pushing to the branch
Please register or sign in to reply