From ac7784c1a4c291ea920ca5725557564925de466e Mon Sep 17 00:00:00 2001 From: Terry <zterry@qq.com> Date: Mon, 27 May 2024 11:01:12 +0800 Subject: [PATCH] Issue #3449974 by zterry95: support webform submission --- entity_info_table.links.menu.yml | 6 ++-- src/Controller/EntityInfoTableController.php | 38 ++++++++++---------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/entity_info_table.links.menu.yml b/entity_info_table.links.menu.yml index 172324e..5b068b0 100644 --- a/entity_info_table.links.menu.yml +++ b/entity_info_table.links.menu.yml @@ -1,6 +1,6 @@ -entity_info_table.manage: +entity_info_table.admin: title: 'Entity Info Table' - parent: system.admin_config_system + parent: system.admin_reports description: 'Administrative interface for the Entity info table module' weight: -10 - route_name: entity_info_table.manage + route_name: entity_info_table.admin diff --git a/src/Controller/EntityInfoTableController.php b/src/Controller/EntityInfoTableController.php index 40290b0..2d97882 100644 --- a/src/Controller/EntityInfoTableController.php +++ b/src/Controller/EntityInfoTableController.php @@ -1,14 +1,14 @@ <?php + namespace Drupal\entity_info_table\Controller; -use Drupal\Component\Serialization\Json; + use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\Url; -use Drupal\devel\DevelDumperManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Drupal\Core\Entity\FieldableEntityInterface; -use Drupal\webform\Entity\Webform; -use Drupal\webform\WebformHelpManager; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** + * + */ class EntityInfoTableController extends ControllerBase { /** @@ -16,14 +16,17 @@ class EntityInfoTableController extends ControllerBase { */ public static function create(ContainerInterface $container) { return new static( - $container->get('devel.dumper') - ); + $container->get('devel.dumper') + ); } + /** + * + */ public function render() { $headers = [ - $this->t('ID'), - $this->t('Name'), + $this->t('Entity Type ID'), + $this->t('Entity Type Name'), $this->t('bundle'), $this->t('bundle label'), $this->t('Field name'), @@ -36,13 +39,12 @@ class EntityInfoTableController extends ControllerBase { foreach ($this->entityTypeManager()->getDefinitions() as $entity_type_id => $entity_type) { // Fail with an exception for non-fieldable entity types. $bundle_list = \Drupal::service('entity_type.bundle.info')->getBundleInfo($entity_type_id); - + + // webform & webform_submission are different entity type :) if ($entity_type_id == 'webform') { -// $query = \Drupal::service('entity.query')->get('webform'); -// dpm($query); + continue; } if (!$entity_type->entityClassImplements(FieldableEntityInterface::class)) { - // dpm("Getting the base fields is not supported for entity type {$entity_type->getLabel()}."); continue; } foreach ($bundle_list as $bundle_key => $bundle_info) { @@ -64,7 +66,7 @@ class EntityInfoTableController extends ControllerBase { ]; $row['bundle_label'] = [ 'data' => $bundle_info['label'], - 'filter' => false, + 'filter' => FALSE, ]; $row['field_name'] = [ 'data' => $field_definition->getLabel(), @@ -75,7 +77,6 @@ class EntityInfoTableController extends ControllerBase { 'filter' => TRUE, ]; $field_description = $field_definition->getFieldStorageDefinition()->getDescription() ? $field_definition->getFieldStorageDefinition()->getDescription() : NULL; -// dpm($field_description); $row['field_description'] = [ 'data' => $field_description, 'filter' => TRUE, @@ -103,4 +104,5 @@ class EntityInfoTableController extends ControllerBase { return $output; } -} \ No newline at end of file + +} -- GitLab