code: public function collectAttributeSettings(IMetaModel $metaModel, $renderSetting)
      {
          $attributeRows = $this
              ->database
              ->createQueryBuilder()
              ->select('*')
              ->from('tl_metamodel_rendersetting')
              ->where('pid=:pid')
              ->andWhere('enabled=1')
              ->orderBy('sorting')
              ->setParameter('pid', $renderSetting->get('id'))
              ->execute();
  
          foreach ($attributeRows->fetchAll(\PDO::FETCH_ASSOC) as $attributeRow) {
              $attribute = $metaModel->getAttributeById($attributeRow['attr_id']);
              if (!$attribute) {
                  continue;
              }
  
              $attributeSetting = $renderSetting->getSetting($attribute->getColName());
              if (!$attributeSetting) {
                  $attributeSetting = $attribute->getDefaultRenderSettings();
              }
  
              foreach ($attributeRow as $strKey => $varValue) {
                  if ($varValue) {
                      $attributeSetting->set($strKey, StringUtil::deserialize($varValue));
                  }
              }
              $renderSetting->setSetting($attribute->getColName(), $attributeSetting);
          }
      }
docs: Collect the attribute settings for the given render setting.
  
  @param IMetaModel  $metaModel     The MetaModel instance to retrieve the settings for.
  
  @param ICollection $renderSetting The render setting.
  
  @return void