code: def aggregation(self, layer):
          
          # We need to disconnect first.
          if self._aggregation and self.use_selected_features_only:
              self._aggregation.selectionChanged.disconnect(
                  self.validate_impact_function)
  
          self._aggregation = layer
  
          if self.use_selected_features_only and layer:
              self._aggregation.selectionChanged.connect(
                  self.validate_impact_function)
docs: Setter for the current aggregation layer.
  
          :param layer: The current aggregation layer.
          :type layer: QgsVectorLayer