code: public function collectMetaModelAttributeInformation(CollectMetaModelAttributeInformationEvent $event)
      {
          $metaModelName = $event->getMetaModel()->getTableName();
          if (!array_key_exists($metaModelName, $this->attributeInformation)) {
              $attributes = $this
                  ->database
                  ->createQueryBuilder()
                  ->select('*')
                  ->from('tl_metamodel_attribute')
                  ->where('pid=:pid')
                  ->setParameter('pid', $event->getMetaModel()->get('id'))
                  ->orderBy('sorting')
                  ->execute()
                  ->fetchAll(\PDO::FETCH_ASSOC);
  
              $this->attributeInformation[$metaModelName] = [];
              foreach ($attributes as $attribute) {
                  $colName = $attribute['colname'];
  
                  $this->attributeInformation[$metaModelName][$colName] = $attribute;
              }
          }
  
          foreach ($this->attributeInformation[$metaModelName] as $name => $information) {
              $event->addAttributeInformation($name, $information);
          }
      }
docs: Collect all attribute information from the database for the MetaModel.
  
  @param CollectMetaModelAttributeInformationEvent $event The event.
  
  @return void