You are here

class GroupContentCardinality in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Validation/Constraint/GroupContentCardinality.php \Drupal\group\Plugin\Validation\Constraint\GroupContentCardinality

Checks the cardinality limits for a piece of group content.

Content enabler plugins may limit the amount of times a single content entity can be added to a group as well as the amount of groups that single entity can be added to. This constraint will enforce that behavior.

Plugin annotation


@Constraint(
  id = "GroupContentCardinality",
  label = @Translation("Group content cardinality check", context = "Validation"),
  type = "entity:group_content"
)

Hierarchy

  • class \Drupal\group\Plugin\Validation\Constraint\GroupContentCardinality extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of GroupContentCardinality

File

src/Plugin/Validation/Constraint/GroupContentCardinality.php, line 20

Namespace

Drupal\group\Plugin\Validation\Constraint
View source
class GroupContentCardinality extends Constraint {

  /**
   * The message to show when an entity has reached the group cardinality.
   *
   * @var string
   */
  public $groupMessage = '@field: %content has reached the maximum amount of groups it can be added to';

  /**
   * The message to show when an entity has reached the entity cardinality.
   *
   * @var string
   */
  public $entityMessage = '@field: %content has reached the maximum amount of times it can be added to %group';

}

Members

Namesort descending Modifiers Type Description Overrides
GroupContentCardinality::$entityMessage public property The message to show when an entity has reached the entity cardinality.
GroupContentCardinality::$groupMessage public property The message to show when an entity has reached the group cardinality.