code: private function addCustomAttributes(array $attributes, HTMLPurifier_HTMLDefinition $definition)
      {
          foreach ($attributes as $attribute) {
              // Get configuration of attribute
              $required = !empty($attribute[3]) ? true : false;
              $onElement = $attribute[0];
              $attrName = $required ? $attribute[1] . '*' : $attribute[1];
              $validValues = $attribute[2];
  
              $definition->addAttribute($onElement, $attrName, $validValues);
          }
  
          return $definition;
      }
docs: Add provided attributes to the provided definition
  
  @param array $attributes
  @param HTMLPurifier_HTMLDefinition $definition
  
  @return HTMLPurifier_HTMLDefinition $definition