You are here

public static function SetGroupsForNodeService::addGroupContent in Open Social 8.6

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  2. 8 modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  3. 8.2 modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  4. 8.3 modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  5. 8.4 modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  6. 8.5 modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  7. 8.7 modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  8. 8.8 modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  9. 10.3.x modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  10. 10.0.x modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  11. 10.1.x modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()
  12. 10.2.x modules/social_features/social_group/src/SetGroupsForNodeService.php \Drupal\social_group\SetGroupsForNodeService::addGroupContent()

Creates a group content.

Parameters

\Drupal\node\NodeInterface $node: Object of a node.

\Drupal\group\Entity\Group $group: Object of a group.

1 call to SetGroupsForNodeService::addGroupContent()
SetGroupsForNodeService::setGroupsForNode in modules/social_features/social_group/src/SetGroupsForNodeService.php
Save groups for a given node.

File

modules/social_features/social_group/src/SetGroupsForNodeService.php, line 164

Class

SetGroupsForNodeService
Class SetGroupsForNodeService.

Namespace

Drupal\social_group

Code

public static function addGroupContent(NodeInterface $node, Group $group) {

  // TODO Check if group plugin id exists.
  $plugin_id = 'group_node:' . $node
    ->bundle();
  $group
    ->addContent($node, $plugin_id, [
    'uid' => $node
      ->getOwnerId(),
  ]);
}