You are here

public function OgResolvedGroupCollection::setVoteWeight in Organic groups 8

Sets the default weight of the votes that are added by OgResolver plugins.

The plugins are ordered by priority. The votes cast by a plugin with a lower priority will have a lower weight in the final calculation.

The vote weight defaults to 0 when the class is instantiated.

Parameters

int $weight: The weight to assign to votes being cast.

Overrides OgResolvedGroupCollectionInterface::setVoteWeight

File

src/OgResolvedGroupCollection.php, line 82

Class

OgResolvedGroupCollection
Contains a collection of groups discovered by OgGroupResolver plugins.

Namespace

Drupal\og

Code

public function setVoteWeight($weight) {
  if (!is_int($weight)) {
    throw new \InvalidArgumentException('Vote weight should be an integer.');
  }
  $this->voteWeight = $weight;
}